Simple, On-The-Fly Image Resizing in PHP

Recently, I installed WordPress and a theme that used an image resizer extension called “TimThumb“. It turns out it’s actually pretty fast and useful. For example, if you have an image on your server called “castle1.jpg”, you can display it in your website as usual using

[cc lang=”html”][/cc]

and, if you want to resize it without having to go into Photoshop, resizing it, uploading it to your server, using TimThumb, you can just do this:

[cc lang=”html”][/cc]

That resizes the image to 200 pixels wide.

There are many other settings you can modify. Look at some examples here.

Of course, it’s better to resize and upload the resized image to your server and reference it directly, but when you’re short on time and speed doesn’t matter, or, if you don’t know what the size of an image will be or it will be determined dynamically, TimThumb can be quite useful.