PHP code example of renatomontanari / cropper

1. Go to this page and download the library: Download renatomontanari/cropper 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/ */

    

renatomontanari / cropper example snippets




use Renato\Cropper\Cropper;

$c = new Cropper("path/to/cache");

// Somente largura (altura proporcional)
echo "<img src='{$c->make("images/image.jpg", 500)}' alt='Imagem'>";

// Largura e altura definidas
echo "<img src='{$c->make("images/image.jpg", 500, 300)}' alt='Imagem'>";



use Renato\Cropper\Cropper;

$c = new Cropper("path/to/cache");

// Limpar cache de um arquivo específico
$c->flush("images/image.jpg");

// Limpar todo o cache
$c->flush();

// No AppServiceProvider ou diretamente no controller
$cropper = new \Renato\Cropper\Cropper(storage_path('app/public/cache'));

$url = $cropper->make('images/image.jpg', 800, 600);