Image resize using PHP -TimThumb Script

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.

Download TimThumb

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.

Usage

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" />

Please note

  • 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)
Categories: Uncategorized

4 comments on “Image resize using PHP -TimThumb Script

  1. 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.

    Ron

Leave a Reply to Amjath Cancel reply

Your email address will not be published. Required fields are marked *