Imagethumb, a PHP image-resizing script
Short introduction
ImageThumb is a PHP script which allows you to resize any image so that you can place the resulting thumbnail on a page. The script was created to avoid the manual creation of thumbnails, which on some sites with lots of images may take a lot of time.
NEW: now supports thumbnail caching!
Please note that using this script on a page with many images to be resized and/or with many hits, might be a very bad idea, due to server load (especially if you disable caching). Use it wisely!
Requirements
The requirements are few:
- a web hosting server (like Apache)
- the GD-libraryinstalled in the system somewhere
- PHP support inside the webserver (PHP >= 4.0.4), with GD-library support enabled
Currently GIF, JPEG and PNG formats are supported.
Usage
Usage is very simple. If image.jpg is the image you want to resize, and the desired maximum width is 400, in the HTML code you’ll have to write:
<a href="image.jpg"><img src="imagethumb.php?s=image.jpg&w=400" border="0"></a>
so that, with a single mouse click, the image can be opened.
But ImageThumb goes even further: if you want to resize an image which stays on a remote webserver, just put its URL instead of its local path and everything will work! (obviously, it will probably take more time to show the resized image)
Thanks for the modifications made in December 2005 by Chris Rossi, now ImageThumb has the ability of saving generated thumbnails in a cache (whose path is specified in the first lines of the script). By doing this, it comes in handy also for forums and bulletin boards, such as the famous phpBB.
In case of broken thumbs, you may want to flush the temporary caching directory, specified in the first lines of the script.
For more information regarding the usage of ImageThumb, please read its source code (it’s very simple) or contact me.
If you want further information about my projects, please visit my software section.
