timthumb.php for WordPress Multisite

timthumb.php is awesome. Unfortunately, it doesn’t work very well with WordPress Multisite. Despite a number of people who have proposed solutions, none of them seem to provide a simple, drop in replacement for timthumb.php which just works. Well, now I have.

The Problem

timthumb.php doesn’t know how to deal with the blogs.dir directory in which WordPress stores images in Multisite. Ideally, you should update your theme to point to the correct directory, or even use WordPress’ built in thumbnail handling. However, if you don’t want to mess around with all of this then simply download timthumb.php and replace your timthumb.php. Problem solved.

How it works

This slightly modifies the function which timthumb uses to find the path to the specified image file. If it detects a blogs.dir directory, it looks through each individual “site” directory until it finds the one which contains the image in question.

There is one potential gotcha in this implementation. If you have identically named files, uploaded in the same month in two different “sites”, this script will use the first one it finds, which may, or may not be the one you intended.

Download

timthumb.php

10 Responses to “timthumb.php for WordPress Multisite”


  1. 1 David Bless

    Listen this is brilliant – you saved me so many hours- so finally my multi-site is working with timthumb without any modification….

    Listen do u think you could upgrade the script to the latest version of Timthumb v1.26? I Tried but i am missing something…

    this is GREAT bro!!!

  2. 2 Matt

    Hi mate,

    I replaced the file but still no change, not even an error.

    Could you help?

  3. 3 carlgreat

    thanks .

    and do you upgrade the code to the latest version ? thanks…

  4. 4 Donna

    THANK YOU, THANK YOU, THANK YOU! You are my hero!

  5. 5 John

    Fantastic. Great solution. I appreciate that you have taken your time to save all of us and make this work. I have twice come to screeching halts with themes because of this path issue.

  6. 6 Poetografie

    this is awesome! saved me many hours… thanks a lot!

  7. 7 Chris Jones

    Saved my bacon. Thanks a bunch!

  8. 8 Anderson

    Dont work here :s is cache? wp-content/blogs.dir/cache?

    wp-content/blogs.dir/1/cache?

  9. 9 Career Girl

    Wow! I am working on setting up a new WP multisite network, and the tinythumb issue was driving me bonkers. I tried 3 different workarounds that I read about, with no luck. When I finally stumbled onto your solution – I was skeptical. How could it be so easy. But I replaced the file and voila! – it just worked.

    Thank You! Thank You! Thank You!

  10. 10 Christopher O'Connell

    @Anderson:

    Can you provide an example of where it’s not working?

Leave a Reply