PHP code example of meriksk / php-image

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

    

meriksk / php-image example snippets


$image = new \meriksk\PhpImage\Image($filename);
 
use \meriksk\PhpImage\Image;

$image = new Image($filename);

$image = new Image($filename, Image::DRIVER_IMAGICK);

$image->save($filename);

$image->save($filename, 60, 'png');

$image->toScreen(60, 'png');

$image = $image->resize($width, $height, $allow_enlarge);

$image = $image->resizeToWidth($width, $allow_enlarge);

$image = $image->resizeToHeight($height, $allow_enlarge);

$image = $image->resizeToBestFit($max_width, $max_height, $allow_enlarge);

$image = $image->resizeToLongSide($max, $allow_enlarge);

$image = $image->resizeToShortSide($max, $allow_enlarge);

$image->crop($x, $y, $width, $height, $allow_enlarge);

$image->autoCrop($width, $height, $position);

$image->thumbnail($width, $height, $fill, $allow_enlarge);

$image->rotate(90);

$image->rotate(45, '#FFFFFF');

$image->flip();

$image->flip(Image::FLIP_HORIZONTAL);

$image->flip(Image::FLIP_BOTH);

composer 

"meriksk/php-image": "~1.0"