PHP code example of ucraft-com / thumbnail-generator
1. Go to this page and download the library: Download ucraft-com/thumbnail-generator 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/ */
ucraft-com / thumbnail-generator example snippets
use Uc\ThumbnailGenerator\ThumbnailGeneratorFactory;
$factory = new ThumbnailGeneratorFactory(...);
$gen = $factory->createImageThumbnailGenerator();
$content = $gen->generate($file, 200, 200);
use Uc\ThumbnailGenerator\ThumbnailGeneratorFactory;
$factory = new ThumbnailGeneratorFactory(...);
$gen = $factory->createImageThumbnailGenerator();
$webPGen = $factory->makeWebPAware($gen);
// Generate a WebP thumbnail using a decorated instance
[$content, $webPContent] = $webPGen->generate($file, 200, 200);