resize image to desired height/width or use it to generate thumbnail images
composer require tbetool/img-thumbnail-generator
$thumb = new ImgThumbnailGenerator($source, $destination, $desired_width, $desired_height, $quality);
- $source => (required) path to source image to generate thumbnail
- $destination => (required) absolute destination path to save thumbnail to
- $desired_width => (required) desired width of the image to resize to
- $desired_height => desired height of the image to resize to, If not provided, proportional height to widht ratio is used
- $quality => quality of the thumbnail, Default to 90
$thumb = new ImgThumbnailGenerator('path_to/myImage.jpg', 'path_to/newThumb.jpp', 250, 250, 100);
True: when thumbnail is generated at destination False: if thumbnail generation is failed
- To not provide
desired_height
parameter and setquality
parameter, passNULL
in place of$desired-height
- To keep
$desired_height
and$quality
to its default, call function like
$thumb = new ImgThumbnailGenerator($source, $destination, $desired_width);
Anuj Sharma (https://anujsh.gitlab.io)