PHP code example of iscos / voodoo-tools

1. Go to this page and download the library: Download iscos/voodoo-tools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

iscos / voodoo-tools example snippets


use Iscos\VoodooTools\Image;

// Thumb com cache por dimensão (padrão CoffeeCode Cropper)
echo '<img src="' . Image::thumb('uploads/foto.jpg', 400) . '">';       // 400px largura
echo '<img src="' . Image::thumb('uploads/foto.jpg', 400, 400) . '">';  // 400x400 (cover)

// Recorte com posicionamento livre (x, y, largura, altura)
Image::crop('uploads/foto.jpg', 'uploads/recorte.jpg', 100, 50, 300, 200);

// Converter e compactar para WebP
Image::toWebp('uploads/foto.jpg', 'uploads/foto.webp', 80);

// Marca d'água com logo (posições: center, top-left, top-right, bottom-left, bottom-right)
Image::watermark('uploads/foto.jpg', 'uploads/final.jpg', 'assets/logo.png', 'bottom-right', 10, 80);