1. Go to this page and download the library: Download toropyga/fimages 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/ */
toropyga / fimages example snippets
$TYPE - create as
$TYPE = 'GIF';
$TYPE = 'JPEG'; //$TYPE = 'JPG';
$TYPE = 'PNG';
$TYPE = 'WEBP';
$path - Path to image;
$dpath - Path to save;
$name - new image name;
$w - end width;
$h - end height;
$img - string of image
$save - end results (куда и как сохранить/вывести файл)
$save = 1 // replace old image and return this file as string
$save = 2 // print new image
$save = 3 // return new file as string
$save != 1 or 2 or 3 //return descriptor of new file;
$IMG = new FImages($TYPE, $w, $h);
$IMG->cut($path, $save);
$IMG = new FImages($TYPE, $w, $h);
$image = $IMG->cut($path);
$IMG = new FImages();
$IMG->resize($path, $save, $w, $h);