Image resizing is big trouble for every project.
I found a perfect script which almost cover every aspect of a developer.
http://github.com/maxim/smart_resize_image/
This script re-size as per given WIDTH and / or HEIGHT.
Output is in FILE as well as in TAG ( image object )
Following are the features..
* If you pass width as 0 (zero) — this function will disregard width, and use height as constraint. Same vice versa. * If you set “proportional” to false - the function will simply stretch (or shrink) the image to its full constraints. * If one of the dimensions is set to zero, and proportional set to “false” - then the image will be forced to stretch or shrink the other dimension, and disregard the zeroed dimension (leave it the same). * If proportional is set to true - the image will resize to constraints proportionally, once again, with possibility to have either width or height set to zero. * The function can use either linux “rm” command, or php @unlink. Most probably you don’t need to ever use that flag, but on some setups - @unlink won’t work due to user access restrictions. * The function will simply replace the file that you give it, with the resized file. * The function supports gif, png, and jpeg, and preserves the transparency of gif and png images. * Tested on GD version 2.0.28 only.
Enjoy Smart Image Resizing ..
Regards
Sushant Danekar
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.