1. Go to this page and download the library: Download escapework/resize 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/ */
escapework / resize example snippets
use EscapeWork\Resize\Resize;
$resize = new Resize('/path/to/image.jpg');
$resize->setWidth(200)->setHeight(100)->resize(); # ajusta o tamanho automáticamente, mantendo no máximo 200px de largura e/ou 100px de altura
$resize = new Resize('/path/to/image.jpg');
$resize->setWidth(90)->setHeight(90)->crop(); # redimensiona, e depois cropa exatamente 90x90, podendo cortar algumas partes da imagem
$resize = new Resize('/path/to/image.jpg');
$resize->setX(20)->setY(30)->setWidth(300)->setHeight(400)->crop();
$resize = new Resize('/path/to/image.jpg');
$resize->setMinWidth(300)->setMinHeight(500)->resize();
$resize = new Resize('/path/to/other/image.jpg');
$resize->setMinHeight(549)->resize();
$resize = new Resize('/path/to/another/image.jpg');
$resize->setMinWidth(300)->resize();
use EscapeWork\Resize\Upload;
$upload = new Upload($original, $newFile);