PHP code example of rutkoski / simplify-thumb

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

    

rutkoski / simplify-thumb example snippets


$thumb = new \Simplify\Thumb();

$filename = $thumb
    ->setBaseDir(dirname(__file__))
    ->setFilesPath('files/')
    ->setCachePath('files/cache/')
    ->load('dummy.jpg')
    ->resize(150, 150)
    ->cache()
    ->getCacheFilename();

$thumb->getCacheFilename();

$thumb->save('path/newfile.php');

$thumb->save();

$thumb->output();

$thumb->cache(IMAGETYPE_PNG);

$thumb->output(IMAGETYPE_PNG);

$thumb->resize($width, $height, $mode, $far, $r, $g, $b, $a);

$thumb->resize(150, 150, Simplify_Thumb::FIT_INSIDE, true, 0, 0, 0, 0);

$thumb->zoomCrop($width, $height, Simplify_Thumb::CENTER);

$thumb->brightness($level);
$thumb->grayscale();
$thumb->negate();
$thumb->contrast($level);
$thumb->colorize($red, $green, $blue, $alpha);
$thumb->edgedetect();
$thumb->emboss();
$thumb->gaussianBlur();
$thumb->selectiveBlur();
$thumb->meanRemoval();
$thumb->smooth($level);
$thumb->pixelate($blockSize, $advanced);

$thumb->offset($top, $right, $bottom, $left, $r = 0, $g = 0, $b = 0, $a = 0);

$thumb->plugin($plugin);

class \Simplify\Thumb\Plugin\Overlay extends \Simplify\Thumb\Plugin
{

    protected function process(\Simplify\Thumb\Processor $thumb, $overlayImage = null)
    {
    	$overlay = \Simplify\Thumb\Functions::load($overlayImage);

    	$w = imagesx($overlay);
    	$h = imagesy($overlay);

    	imagecopyresampled($thumb->image, $overlay, 0, 0, 0, 0, $w, $h, $w, $h);
    }

}

$thumb->plugin('\Simplify\Thumb\Plugin\Overlay', 'overlay.png');