I’m designing a website and I need to:
- Upload the image
- Validate that it’s an image (and not, oh I don’t know…. a virus 🙂 )
- Resize the Image
- convert to jpg
Essentially basic image upload
Instead of writing my own I’m trying to find a PHP class that let’s me do all this, because as Jeff Atwood said, "never design what you can steal"
So far, Ive found:
- https://stackoverflow.com/questions/4997127/php-class-to-upload-image-from-url-and-resize-it (I know it looks like a duplicate, but its not because it is asking for a URL fetcher)
- http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/
- http://www.verot.net/php_class_upload.htm
- http://blog.freelancer-id.com/index.php/2010/03/21/php-image-crop-resize-upload
- http://www.phpclasses.org/package/2181-PHP-Process-files-and-images-uploaded-via-a-form.html
- https://github.com/dimo414/imgupload
Does anyone have any experience with these classes? Can you recommend an outstanding image upload class?
I tend to use a framework of one description or another, which cover’s the file upload part. However, do have a recommendation for the cropping bit:
Imagine – https://github.com/avalanche123/Imagine
And if you want to make the uploader a tiny bit better than just an input type=file, try:
https://github.com/valums/file-uploader