PHP Image Resize Classes
-
29-09-2019 - |
Question
My website allows uploading of images. I limit images to 10 megapixel or less JPEG images, all images get stored in a directory. Now I want the images resized on the fly and I am looking for a PHP class/library that can do that for me. While I can write (and I have written) gd-library code for resizing images I want something that's stable tested and more importantly provides some kind of caching. I intend to use the script like this:
http://www.website.name/some-script.php?image=HPIM0001.jpg&max-size=600x450
Any suggestions (do mention pros/cons).
Solution
Try using phpThumb to do that.
OTHER TIPS
There's WideImage, which is pretty good. Caching is AFAIK not built in, but that should be trivial to put on top...
if (!file_exists($filename . '_thumb.jpg')) {
// Load original, resize, save to $filename_thumb.jpg
}
// serve $filename_thumb.jpg
http://shiftingpixel.com/2008/03/03/smart-image-resizer/
Includes caching, probably will do what you're looking for.