Image Resize: TimThumb PHP Script

PHP-logoTimThumb, created and maintained by Tim McDaniels, Ben Gillbanks and Darren Hoyt, is a rather popular open source, image resizing PHP script, mostly used for generating thumbnails for blogging purposes on the fly. The script is fairly powerful, executes quickly and needs almost nothing from a developer in order to get it up and running on their own project.

The script makes use of the GD library to resize images based on the parameters used when calling the script. Thumbnails maintain aspect ratio and the script deals with jpg, gif and png files pretty well. It also has a caching system built in which helps keeps things fast.

In terms of parameters, the script allows you to set any of these for an image to be resized:

  • w: width
  • h: height
  • zc: zoom crop (0 or 1)
  • q: quality (default is 75 and max is 100)

And calling the script is as easy as this:

<img src=“/scripts/timthumb.php?src=/images/whatever.jpg&h=150&w=150&zc=1″ alt=“”>

To read more about TimThumb and see it in action, visit Darren Hoyt’s site if you can, and to download the script itself, pay a visit to its Google Code home here.

Related Link: http://timthumb.googlecode.com/

Related Posts :

About Craig Lotter

Craig Lotter is an established web developer and application programmer, with strong creative urges (which keep bursting out at the most inopportune moments) and a seemingly insatiable need to love all things animated. Living in the beautiful coastal town of Gordon's Bay in South Africa, he games, develops, takes in animated fare, trains under the Funakoshi karate style and for the most part, simply enjoys life with his amazing wife and daughter. Oh, and he draws ever now and then too.
This entry was posted in Software & Websites, Technology & Code and tagged , , , , , , . Bookmark the permalink.