PHP code example of elfsundae / intervention-image-filters

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

    

elfsundae / intervention-image-filters example snippets


use Intervention\Image\ImageManager as Image;
// use Intervention\Image\Facades\Image; // For Laravel
use ElfSundae\Image\Filters\Fit;
use ElfSundae\Image\Filters\Resize;

$image = Image::make($file)
    ->filter(new Resize(300, 400))
    ->save($path);

$image->filter(new Fit(320));
$image->filter(new Fit(320, 400, 'top-left'));
$image->filter(new Fit(320)->upsize(false));

$image->filter(new Resize(300, 600, $aspectRatio = false));
$image->filter(new Resize(300, 600)->aspectRatio(false)->upsize(false));