PHP code example of toropyga / fimages

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);


$IMG = new FImages();
$IMG->resize_pro($path, $save, $w, $h); # proportion resize

$IMG->fill($path, $save, $w, $h); # fill background

$IMG->getTempFile($img, $function, $save, $w, $h);


$IMG = new FImages('JPG', 40, 40);
$ds = $IMG->resize($path);
$IMG->createImgCopy($ds, $dpath, $name);

<img src='".$IMG->captcha(false)."'> or $IMG->captcha();

$IMG->getKeyString(); // captcha in string