Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ImgResize

License: MIT

Yet another library based on gd to resize images with method chaining.

Examle

require_once ('vendor/autoload.php');
useRoot4root\ImgResize\ImgResize;
$image = newImgResize('pathToImage.jpg');
$image->resampleToHeight(500)
->sharpen()
->save('pathToSave.gif');
$watermark = newImgResize('pathToWatermark.png');
$image->addImage(newImgResize('anotherImage.png'))
->joinVertical()
->watermark($watermark)
->save('pathToSave.jpg');
$image->watermark($watermark)->save('pathToSave2.jpg');

Notes

Every time you modify image, ImgResize returns new instanse of self as a result. So you could assign instance to a variable at any moment, which will stay immutable. Be careful with saving instances due to the memory limit, though.

$imageWithWatermark = (newImgResize('pathToImage.jpg'))->watermark(newImgResize('pathToWater.png'));
$imageWithWatermark->resampleToRectangle(500,500)->save('path.jpg'); //Fits image to rectangle by height or width - which is bigger. $imageWithWatermark->resampleToWidth(1000)->sharpen()->save('path.png'); //Still one resample - best quality

About

Yet another image resize library

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages