Something every WordPress theme should have is the timthumb script.
This PHP file is an image resizer with a cache sistem. It’s fast, easy and works on the fly.
How it works?
You copy the thumb.php file into your theme folder. Then you create the cache folder called “cache” that’s where it will save the cached images.
Please note maybe you will have to set 777 permisisions to the cache folder.
How to resize an image?
Very simple. Let’s see an example:
I have this image (below) wich is 1118px width, 646px height and 392kb.
There is no way you should add this image to any website. The reader will have to download this large image just to show an small version (like above, 500px).
Here is when timthumb comes in.
We will use the timthumb php and give it to him 3 parameters:
1) Source Image (src)
2) Width (w)
3) Quality (I recomend you 90) (q)
All allowed parameters are:
zc: zoom crop (0 or 1)
q: quality (default is 75 and max is 100)
With this url it creates a 200px width image wich is only 20kb!
Amazing, isn’t it?
You can use it whereever you want in your theme. I’ll post how to use the timthumb retrieving the image attachment of your post soon
Download the lastest version from the oficial site: