root4root / imgresize
Yet another images resize library
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/root4root/imgresize
Requires
- php: >=5.4.0
- ext-gd: *
Suggests
- ext-exif: Rotate jpg files
This package is not auto-updated.
Last update: 2025-10-30 21:51:35 UTC
README
Yet another library based on gd to resize images with method chaining.
Examle
require_once ('vendor/autoload.php'); use Root4root\ImgResize\ImgResize; $image = new ImgResize('pathToImage.jpg'); $image->resampleToHeight(500) ->sharpen() ->save('pathToSave.gif'); $watermark = new ImgResize('pathToWatermark.png'); $image->addImage(new ImgResize('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 = (new ImgResize('pathToImage.jpg'))->watermark(new ImgResize('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