Playing with images has become quite a core functional requirement of so many applications and not just Image/Photo apps. Resizing an image becomes one of the fundamental things in handling and displaying images, be it in Blog Themes, Custom Photo Galleries or just website designs and layout.
Here is a very simple way to do it:
Step One: Download this script and put it in your root “/” server directory.
Step Two: Create a folder named “Cache” and set its permissions as “777”
So the script “timthumb.php” will be located at: http://www.yourdomain.com/timthumb.php
And the Cache folder will be created in the root “/” with “777″ permission.
Step Three: Now you’re ready to use it! Say for example, you want to resize an image located at: “yourdomain.com/images/Sample.jpg“. The Width you want to resize it to is “100″ (The script will take care of the aspect ratio so don’t need to provide relevant height)
You just need to do the following with your <img> tag in html file:
<img src=”/timthumb.php?src=/images/Sample.jpg?w=100&zc=1″ alt=”" />
This is it! Incase you need more help for your custom needs, feel free to leave a comment here and I will reach back.
Here is a sample:
Original image : <img src=http://www.programmerfish.com/wp-content/uploads/2009/12/02.jpg alt=”" />
![]()
Resized to width = 150 : <img src=”/timthumb.php?src=/wp-content/uploads/2009/12/02.jpg&w=150″ alt=”" />
![]()
If you like this article, then subscribe to our feeds for FREE to get more interesting and original technology updates. Click here to get FREE updates in your email




{ 1 trackback }
{ 7 comments… read them below or add one }
Looks very interesting! But unfortunately, the download link doesn’t work. I think you’ll need to zip it or rename it to txt so we can all give it a try.
@Scoot: Thank you for noticing…it is fixed now (I have put a .zip file to download)
Total newbie past HTML and to domr degree Javascript. But what advantages does:
offer over
?
Just curious.
Thanks
Garth
If you host your site on Windows platform, you can download QuickResizerAPI Image Resizer to resize your images programmatically in batches. It supports programming language like C#, VB .NET, and even DOS (shell command).
@Garth: This is a simple one liner call inside an HTML
tag. So resizing an image has been simplified alot!
@John: Thanks for the link but API’s seem alot complicated for most users.
For Java servers check out this component: http://www.servletsuite.com/servlets/imagescale.htm
http://www.of-nutrition.com/images/book.jpg
Hi, my name is Rebecca.
I’m new here, and was hoping to get some feedback from the health & weight loss pros!
I have been hired to make a weight loss – themed website, selling only one particular ebook. I must admit, the book is excellent, but I’m having serious trouble writing a persuasive sales copy, that health and weight loss-oriented website visitors would find convincing enough to make a purchase.
Thus, my request- would you be willing to help me to evaluate the sales letter I’ve written so far? Your help would be tremendously appreciated! I cannot pay you for that, but I can offer you a comlimentary copy of 76 No-Sugar Desserts, containing delicious stevia recipes and valued at $15, just for 2 minutes of your attention!
First: go to Of-Nutrition.com and read the entire sales letter for Weight Loss Cover-Up Exposed
Then go to my 10-question (yes/no) survey at
http://www.screator.net/showform.php?f=1917565430
Survey Access Code is: wlcu
When you finish the survey, a link to the bonus will show up.
Hoping to get a helping hand here.
Thankful – Rebecca
Dear Mods: If this is the wrong section of forum please move if required
Leave a Comment