PHP code example of rfd / imagemagick

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

    

rfd / imagemagick example snippets




use Rfd\ImageMagick\ImageMagick;
use Rfd\ImageMagick\CLI\Operation\Factory as OperationFactory;
use Rfd\ImageMagick\Image\File;
use Rfd\ImageMagick\Options\CommonOptions;

ationBuilder($image);

$operation_builder
    ->resize()
        ->setWidth(320)
        ->setHeight(240)
        ->setGravity(CommonOptions::GRAVITY_CENTER)
    ->next()
    ->slice()
        ->setWidth(300)
        ->setHeight(200)
        ->setOffsetX(0)
        ->setOffsetY(0)
        ->setGravity(CommonOptions::GRAVITY_NORTHWEST)
    ->finish($output);