TimThumb is an image resize script that can be using to resize an image and can also crop an image. The croping is an awesome feature which saves the output file from streching up when both width and height are given.
The script was written by Tim McDaniels as a way to achieve the core functionality of phpthumb while using half the code. Ben then added PNG and GIF support, plus improved speed and caching.
Simply upload the file to your root and use the code given below to use it
<img src="timthumb.php?src=/images/filename.jpg&h=150&w=150&zc=1" alt="some text" />
- TimThumb requires the GD library, which is available on any host sever with PHP 4.3+ installed.
- Once installed and in-use, TimThumb will automatically create a /cache/ subfolder with proper write-permissions. If your host server doesn’t allow this by default, be sure to manually change the /cache/ folder permissions to 777
TimThumb allows the following parameters:
- w: width
- h: height
- zc: zoom crop (0 or 1)
- q: quality (default is 75 and max is 100)
4 comments on “Image resize using PHP -TimThumb Script”
Already know about it. Thanks for the download link.
For new programmers, you can also do a post about how to install gd library as that is must for image resize.
My gifs are resized by timthumb, but gifs stop animating when resized..
Is there any workarround for this in timthumb..?
timthumb creates a thumb of the orginal image and stores in the cache folder. So the animation effect of the gif file will be lost.
how to display GIF image in TimThumb with out lost animation?