1. Go to this page and download the library: Download arthurhoaro/web-thumbnailer 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/ */
arthurhoaro / web-thumbnailer example snippets
use WebThumbnailer\WebThumbnailer;
$wt = new WebThumbnailer();
// Very basic usage
$thumb = $wt->thumbnail('https://github.com/ArthurHoaro');
// Using a bit of configuration
$thumb2 = $wt->maxHeight(180)
->maxWidth(320)
->crop(true)
->thumbnail('https://github.com/ArthurHoaro');
echo '<img src="'. $thumb .'">';
echo '<img src="'. $thumb2 .'">';
// returns false
$wt->thumbnail('bad url');
// Sizes are given in number of pixels as an integer
$wt = $wt->maxHeight(180);
$conf = [WebThumbnailer::MAX_HEIGHT => 180];
$wt = $wt->maxWidth(320);
$conf = [WebThumbnailer::MAX_WIDTH => 180];
// Sizes are given in number of pixels as an integer
$wt = $wt->crop(true);
$conf = [WebThumbnailer::CROP => true];