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