Skip to content

A Brief History of TimThumb

When we were building Mimbo Pro – Darren came up with the idea of automating the image thumbnail resizing – and this was the idea that sparked the development of TimThumb.

This was all part of making the theme site as easy as possible to maintain. Initially it was based loosely on phpThumb stripping out all the fluff and making it nice and streamlined.

Mimbo Pro screenshot including the use of TimThumb

Development was started by Tim (hence the name) one of the programmers at Category4 where Darren worked. Shortly after the release of Mimbo Pro, with Tims blessing, we decided to open source the code releasing TimThumb on Google code, and that’s when everyone else started using it.

Nowadays 95% of the premium themes teams are offering TimThumb support – and it’s a great feeling, knowing so many are making use of code I worked on.

I have now taken over development of TimThumb entirely which means that most new features and bug fixes come out of my requirements and findings. Of course I do check the issues list at Google code, but I probably don’t do that as often as I should.

As well as simply resizing and cropping images some of the new features I have introduced since the release of TimThumb last year include:

  • Alpha image resizing for gif and png images
  • Improved image browser caching
  • Automated cache clearing, reducing the size of the cache files on the server

The future of TimThumb

Currently I am working on a handful of new features for TimThumb. The two main ones are reintroducing jpg image compression (I removed it to simplify code and to introduce alpha image scaling ie transparent gifs – turns out to be less good an idea than I thought), and adding remote image resizing (resizing images from external domains eg flickr.com).

These two features should help make TimThumb even more widely used, and will also answer some of the support requests I’ve been receiving recently. It doesn’t end there though – as I am sure there are many new features people want, including some of my own.

Now I need people to help beta test the new version of TimThumb, in particular the remote image resizing so if anyone is interested let me know in the comments and I will send you an email with the link. This is technically quite a big update so I want to make sure it is all working before committing to Google Code.

Share

Join me, me, Nollywood Forever, Shandy. They're all chatting about "A Brief History of TimThumb" below ›

Read Comments

77 Comments »

  1. Awesome, Ben! I recently released 5 WordPress themes over at ThemeForest, and every one of them (now) uses TimThumb for dynamic image resizing. The only reason I had gone with Smart Image Resizer for the first 2, was that I needed to have a variable height on some images. TimThumb requires a width and height, while Smart Image Resizer doesn’t. But man, the headaches that script caused! Nearly every support request I endured was due to Smart Image Resizer compability issues. Not a single one since switching to TimThumb.

    Anyway, I’d love to beta test the next version. I use transparent PNGs on my own blog and have been manually resizing them for smaller versions.

  2. Two Feature Suggestions:

    * Focal Point – TT crops from the center – would love to see a feature for a user specified point of interest. Even something simple like Left, Center or Right would be better than just center. It’d be nicer still to define nine regions (TL, TC, TR, L, M, R, BL, BM, BR)

    * Percentage Scale: Currently TT asks for a defined width or height. I want the height at 100% while using a width defined in pixels – this stops the image from cropping. (I currently use “0″ to fool TT into using 100% for W or H)

  3. Thanks guys – I shall send over the new versions in a second :)

    Matt – Not sure which TimThumb you’re using but there is a version that supports just supplying one dimension (the version I will send you works for sure) so maybe you can switch :)

    Kel – thanks for the suggestions. As I mentioned about the percentage scale one “should” work. The focal point would be handy if you know what you’re doing but I am not sure how useful it would be when making themes as you have no idea how people will use the image…

  4. Excellent work on the script. I would like to beta test the new version and am particularly interested in being able to use external off domain images for several shopping sites I am developing.

    • Hi Shandy and Kevin – thanks for the offer of help. I am at work now but will make a note to send you the latest version when I get home.

  5. I am trying to create a Word Press site where I can market my fine art prnts. The thumbnails are the problem as I don’t know if I can get TomThumb to resize the entire image of each print. I can’t cut the image in the thumbnail. I need thumbnails that vary in size as my prints do. Can this be done with TomThumb? It would be very helpful to the thousands of artist out here who want to manage their own sites (WordPress) and present the entire image in the thumbnail. Help!

  6. Hi Ben,
    I’m doing some more work at the moment on a project and I have a testing site on a subdomain. The paths to the images are all on the same subdomain but timthumb wont show the images. I’ve never used it on a site with a subdomain before and ws wondering if this comes under the same category as a different domain? Presumably that will be resolved by the same code as the cross domain fix?

    Shandy

  7. I’ve used and am using phpthumb/timthumb for several (WP) sites.

    And I am very curious about the cross-domain feature. Please mail me copy of the beta version, I will try it out since I’m in the middle of testing anyway…

    Good luck with it.

      • I’ll have to have a look at your changes. TimThumb does actually work across domain now. The reason I block it is for security rather than ease of use.If you allow files from any domain it will be a lot easier to load a php file onto someone elses website.

      • I do agree with the security issues, I have used it on a few projects, in conjunction with my WPMU alterations to the file.

        These are definitely hacked, but oh well ;)

  8. I’m going to be writing a new post with a download link and an explanation of how to set it up. Hopefully that will make things a bit easier for everyone :)

  9. I would love to test the new version as well… I will check back later for the download link. Thanks for all your hard work on this!

  10. Works great. I had no problems getting the cross domain stuff to work and in fact for the purpose I am using it I can actually disable the domain checking with confidence. Great work Ben

  11. I have encountered my first problem using Tim Thumb. I’m sure it’s nothing to do with the code but rather the server it’s running on but I thought I could ask and see if anyone know’s a reason. For some reason, although the temp/cache folder is writable the images are created in it with 0 bytes. The file is there but it has no data. I’m stumped. Anyone know a reason why that might be. Oh, the images in question are from external domain.

    Thanks

  12. Hi Ben

    TimThumb and WPMU compatibility – And now for something completely different!

    I’m sure I speak for many WPMU OP’s when I say this – we have TRAWLED the INTERNET, in search of the final answer to compatibility between TimThumb and WordPess MU (blog directories and cache permissions etc.. etc.. etc..).

    Now that you’ve taken on this much required, requested and popular varmint of a script, can you please implement your fine knowledge to solve this if not controversial issue because there are more and MORE WP and WPMU theme designers implementing this script – it’s becoming a necessity!

    Now then, personally, I would go as far as to offer YOU “no one else” no more than (three sheep AND one fine young goat) in return for getting this predicament finalized and sorted – yes, as you’ve ascertained quite rightly, I’m a farmer and I reside in Kurzukstan.

    Would you be interested in this offer – seriously!

    If so, contact me immediately, and I will arrange for my sister, who is also “available for extra or intra marital relations” to contact you in due course with delivery of these fine specimens wherever you request – BTW: anything goes, say no more – mum’s the word!.

    Thank you – honorably awaiting your reply :)
    Borris

    • Hi

      Thanks for your very kind offer but I am more interested in camels. If you had a couple of those then we might have a deal?

      What I really need though is ftp access to a website using a WPMU install that doesn’t work. I have tried asking for it before but nobody wants to share. I have installed WPMU myself and TimThumb worked fine so I need to be able to see it not working and modify the code on the server so I can test it fully. I want it to work but at the moment am having a hard time getting a method for testing it. If you can help me with the testing then you can send the login details via my contact page (http://www.binarymoon.co.uk/contact/)

      Thanks

  13. Aaaa, Camels.. Alas, I’m afraid sir that this is an area I can not deal in. Although, one of my sisters “Umfoofoo” does have a surprising likeness to the beast. Below is a picture of her, don’t be afraid on first view, as they say, beauty is in the eye of the beholder..

    My sister Umfoofoo is on the left of the picture, she is hanging out with one of her girlfriends.

    I will contact you in due course..

    Borris :)

  14. Hi there Ben…

    Just a quick question… I’d like to implement TimThumb on my site. However, the site has been up and running for years now, and I have loads of images I’d like to keep… so is there a way to change the path to images in TimThumb so that the data in the Image field doesn have to be for example wordpress/uploads/images/image.jpg but just image.jpg?

    Tnx in advance…

    n.

    • Hi – there’s no reason you can’t modify TimThumb to adjust the image path to point wherever you like. A lot of it depends where you want to place the TimThumb script. If you placed TimThumb in the image directory you could simlpy pass the filename as the source (make sure to include the cache directory as well)

  15. I am having the same issue with WPMU and Tim Thumb… In my case, I have the lastest version of Mimbo Pro installed as the theme for the front blog installation of WPMU… I would be happy to help… as I can’t definitively solve my problem. Has anyone found a solution to this yet.. I would love to figure it out..

  16. If you are still looking for a wordpress-mu server setup to test your scripts on I am more than willing to provide a site and access.

    I have probably collected a few dozen themes that use timthumb, and not one of them works in an mu environment. It all comes down to the server paths due to rewrite issues.

    Simply send me an email letting me know your interested, and I’ll respond within 24 hours.

    It would be HUGE to finally have this problem resolved once and for all.

    Sorry, no sheep, camels, or sisters to offer, just a couple of seriously lazy cats

  17. Hi Ben,

    Thanks for the nice script! I’ve just recently used this script. I’ve no idea that this timthumb script just recently developed as os and still on beta.

    I’m using timthumb script for my wp theme development but having trouble with image catching from attachment url using :
    src=ID); ?>

    Other than the attachment, everything seems fine. If i’m using it on my machine (using easyPhp) everything is alright but not on my domain. and this problem is only when using that specific attachment function mentioned.

    Thanks for help.

  18. I can say this is a really great script. Thank you very much!

    The only problem I’ve encountered is when trying to move my blog from a domain to another. The thumbs aren’t simply displayed. I have had the same problem when uploading files from the BlackBerry for WordPress App. What can I do to avoid this issue? Thanks!

  19. Is it will be good if you can tweak this code to prefer future problem such as readfile problem and enable to use crop parameter, such as I need to crop the image from the top left, or some times we need to crop from the center of images.

  20. I would be really interested in testing the beta of TimThumb with flickr. I am using a theme that uses timthumb but none of my pictures will show up because all of my posts are done using flickr. Would love to hear from you!

  21. Thanks for the reply. I downloaded the file, deleted the current text and then copied and pasted it into my timthumb.php file on my theme editor (Platformate)

    I don’t know if I am doing the right thing as I am a complete novice.

    Anyway after I did that I enabled Timthumb and the result was exactly the same as it was with the old code. The flickr pictures come up as red x’s in the place of the thumbnail. The one picture that is uploaded onto wordpress as opposed to flickr does show up, same as with the old code.

    For now I have disabled timthumb as the red x’s can be quite unsighly as you can imagine.

    Please please please if anyone can help me out here I would be eternally grateful!

    Thanks in advance!

  22. I like the script but I have old version. Is it possible to download latest version from some site but no from SVN. I would not like to install subversion client just for once. Thank you.

  23. Then what do u do after u have the code? Do you paste it into the timthumb folder with the other code or replace it? Or put it in a file in the cpanel… Excuse the ignorance I’m new to all this web stuff!

  24. I have done exactly as directed and no joy. I enabled the timbthumb “first image” feature in my theme and My flickr photos still show up as x’s on the front page where there should be pictures.

    If anyone could tell me where I could be possible going wrong I’d much appreciate it!

  25. Im using the script but it does not allow me to use external images.Is there a way to fix this since i like to use another site to host the images?

  26. Hi thanks so much for your development on this. I’m getting the following error in the log.

    [30-Apr-2010 08:44:37] PHP Warning: imagecreatefrompng() [function.imagecreatefrompng]: ‘/home/directory/public_html/domainname.com/wp-content/themes/ThemeName/scripts/temp/’ is not a valid PNG file in /home/directory/public_html/domainname.com/wp-content/themes/ThemeName/scripts/timthumb.php on line 312
    [30-Apr-2010 08:44:37] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/directory/public_html/domainname.com/wp-content/themes/ThemeName/scripts/timthumb.php:312) in /home/directory/public_html/domainname.com/wp-content/themes/ThemeName/scripts/timthumb.php on line 728

    Any help is greatly appreciated.

  27. Hi Ben,

    Loving Timthumb and the way that it integrates with my site, excellent work.

    Really looking forward to the image compression, I have noticed that the thumbs are pretty large at the moment which is slowing my page loading times a fair bit.

    • Hi Tom – glad you’re liking the script. If you grab the latest version from Google code then you will see the images are being compressed already :)

      • Ah yes, sorry about that. Noticed that I don’t have the latest version. Doh!

        However, replacing the code just gave me a load of blank thumbs.
        I’m using it with Branford magazine and I’m a php noob.

        I’ll have to have a dig and try to figure out what’s going wrong.

      • I am afraid I haven’t used Branford before so I don’t know if it’s using a modified version of the script or anything like that. If you right click on the image and view it in a new tab you should be able to see an error report telling you what to fix.

  28. Hello there!
    Ive just started using a theme that utilizes timthumb after my Blog crashed a few weeks ago.I just noticed that timthumb doesnt allow remote hotlinking which is a bummer since I upload all my images to Flickr.

    Is there any way to allow access to flickr yet?

    I am a technical klutz and would appreciate a simple answer/guide ^^;;

  29. Hi Ben,

    I am using your excellent script on my site http://www.hi-tech-gadgets.org

    I was pulling images from the amazon feed fine until about 3 days ago.

    Any ideas? Thought it might have been the cache so I have already increased the size but still nothing..

    Thanks
    Mike

    • right click the broken image and open it in a new tab and it will tell you what the problem is. You’re not displaying the image src so maybe the amazon feed format has changed.

  30. Hi, I have 2 sites installed on single installation wordpress 3.0. One is domain.co.cc and another is subdomain.co.cc.

    timthumb works ok on the main site(domain.co.cc) but I get the red “x” broken link for the subdomain site (subdomain.co.cc).

    When I right click the broken image and open it up in a new tab/window, the image shows up.

    I read about timthumb not able to work with “relative” domains and I have amended the codes accordingly to point to wp-content/blogs.dir/blogid/files/…. but still the red “x” is there…

    I have definitely run out of ideas now…. please help?

  31. sorry.. typo error in previous post.. the subdomain site URL will be subdomain.domain.co.cc and not subdomain.co.cc ..

  32. Hi Ben, awesome script.
    I’ve added multiple feeds now and there hasn’t been any problems lately, however my most recent feed only pulls about 50% of the thumbnails on the homepage. The error I receive is on line 312 – not a valid PNG file. That said, when I go into the post directly (still on my site using feedwordpress), the PNG file appears fine. The issue is limited to the main page thumbs. Any idea? The site is golfforums.ca if that helps at all.

    Cheers,
    Mike

  33. Thank you for this script.

    I have seen timthumb go from 8kb to 17kb, and the CPU usage keeps increasing with every feature addition.

    Is it possible to create a timthumb lite, very small, very efficient version with optimal cache options?

    • Hi Lisa – TimThumb already has the optimal cache options already, I always try to make sure it’s as fast as possible. The complex processing only happens the first time the image is accessed, after that the caching takes over and the hit to the server is as minimal as can be.

      Are you sure the extra cpu isn’t coming from the fact that you are using the script more and your website is becoming more popular (or some other factor). If you go backwards in time in Google code and look at the first version released, then see how that performs – what is your cpu usage like then? My guess is worse – but I’d be interested to know if it improves.

      • I did exactly that and went to a version which is only 9kb and does not have a version number. This improved by overal CPU usage and also my bandwith went down.

        My website has not inceased in popularity, however I do use the script for every image and the homepage does have abour 20 images.

        I did turn off the cache and then really noticed how good the cache was working, so I turned it on again.

    • you could create your own rewrite rules in htaccess to use timthumb without the ? – maybe I could write a blog post about this… nice idea – thanks :)

      • I wish I could, but my knowledge of .htaccess is not that good. I am going to do some reading and see if I can find something. If so, I will let you know.

  34. Hi.

    We are victims of the timthumb security hack as the file was used in a theme Arthemia we chose. A pain because we are not professional webdesigners.

    Do you have any details of how the hackers are exploiting this and what they do? Or more to the point, who to undo it?

    All of our thumbnails were removed. There seems to be some random code corruption (addresses mainly) in the mySQL table and the hacker was able to gain entry and change our admin email address for his own.

    I have upload the most recent file, I have no idea if this is meant to “just work” with Arthemia at all.

  35. this is a message i got form my hosting company about problems with timthumb script…

    Hi Bojan,

    This is due to a mod_security rule which we’ve implemented to block exploits of the timthumb script when using a remote file include. I’d recommend contacting the theme developer and asking them to modify the theme to use relative or absolute paths rather than remote file includes to build the thumbnail URLs. Thank you.

    —-
    Adam
    Rochen Limited

    is there anything you can do to help me here

    Thank you

Comments are closed. Let's continue the conversation on Twitter.
css.php