230 thoughts on “How to Make TimThumb Work With WordPress Multisite Leave a comment

  1. Awesome. 🙂 I’m gonna be handing this out to everyone now. Especially the devs of themes that aren’t working right. 😀

    1. That’s great Andrea – thanks 🙂

      I’ve tested it a reasonable amount myself but I really hope it works for others, and would welcome any feedback you might have.

      1. Hi Ben, i need your help. As you can see on my website(studionews24.com) i use timthumb for the images preview. And my problem is that sometimes these images don’t load and if a want to show them i have to refresh the page. How can i get all images load at the same time without problems of view? I wait an answer, thanks for the help.

  2. Thanks a lot Ben!

    I’ll implement this into our themes at Woo, so there will be no more tweaking the path in thumb.php manually for WPMU users 🙂

    1. Assuming you mean WooThemes, I’m still having trouble with the Olya theme on a subdirectory network installation.

  3. Hi Ben, great post. By a fluke I was working on exactly this last week for a site running WPMU and using the Arras theme. I implemented a fix for it using the exactly four steps you mentioned, which I completely agree with.

    The Arras theme has a library file (/wp-content/themes/arras-theme/library/template.php) that prepares calls to timthumb as well as doing other stuff. The following code is the tweaked version of the arras_get_thumbnail function, I found that three lines fixed Arras for WPMU… I think that this tweak should work for most sites:

    function arras_get_thumbnail($w = 630, $h = 250) {

    global $post;

    $thumbnail = get_post_meta($post->ID, ARRAS_POST_THUMBNAIL, true);

    if (!$thumbnail) {
    return false;
    } else {

    // *** Added lines follow, copy these into your template.php file ***
    global $blog_id, $current_site;
    preg_match( "//files/(.*)$/i", $thumbnail, $matches );
    $thumbnail = "http://" . $current_site->domain . $current_site->path . "wp-content/blogs.dir/" . $blog_id . "/files/" . $matches[1];
    // *** end of added lines ***

    if (ARRAS_THUMB == 'phpthumb') {
    return get_bloginfo('template_directory') . '/library/phpthumb/phpThumb.php?src=' . $thumbnail . '&w=' . $w . '&h=' . $h . '&zc=1';
    } else {
    return get_bloginfo('template_directory') . '/library/timthumb.php?src=' . $thumbnail . '&w=' . $w . '&h=' . $h . '&zc=1';

    Hope that’s helpful,


    1. Hey James – that’s great. Good that we both came up with basically the same solution as well, it confirms that I was thinking along the right lines 🙂

      You should point the developer of Arras this way so that he can update the core theme to work properly.

    2. Brilliant James. I was about to pull all of my hair out trying to get Arras to work with WPMU, but this works perfectly.

      Thanks for posting it.

      1. Hey Dan,

        Did you manage to get Arras displaying thumbnails from secondary blogs on the master blog page on your WPMU installation? It doesn’t seem to work correctly


  4. Hmm.. just in time for WP 2.9’s (and presumably MU 2.9) Post Thumbnail feature 🙂

    Seriously though, having used TimThumb in a few projects, I know the benefits (and some pitfalls too), but others may not. Perhaps a followup post about how TT compares with 2.9’s Post Thumbnail feature.

    1. You know what – I was thinking about this as well 🙂

      The new post thumbnail functionality is nice but there are too many drawbacks for (serious?) theme developers to want to use it. Nice idea though – and I will probably be using the new function as part of the theme process… but it will still tie into TimThumb in the end 🙂

      1. and I will probably be using the new function as part of the theme process… but it will still tie into TimThumb in the end

        That sounds great! This I want to see!

  5. I’m trying hard to get a handle on making this work in mu. I went ahead and added the function you gave us in ‘pulling this code together’ to my theme functions.php file.

    Now I am trying to modify the template to work with the new function.

    Here is an example of a thumbnail being put onto a page in my theme, prior to the wpmu upgrade
    <img class="box" src="/thumb.php?src=ID, "thumb", $single = true); ?>&h=180&w=581&zc=1&q=80" alt="" />

    Here is my ‘best guess’ at what it now should be with the new function from my theme’s functions file, although it does not seem to work.

    <img class="box" src="/thumb.php?src=&h=180&w=581&zc=1&q=80" alt="" />

    Could someone please let me know what I am doing wrong, and why I am wrong so that I can learn from this?


  6. code did not paste in above properly, let me try another route with spaces added where they should not be to see if this blog allows it to show up right.

    <img class="box" src="/thumb.php?src=ID, "thumb", $single = true); ? >&h=180&w=581&zc=1&q=80" alt="" />

    my moded vs.

    <img class="box" src="/thumb.php?src=ID, "thumb", $single = true); ? >&h=180&w=581&zc=1&q=80" alt="" />

  7. Ok, I give up trying to paste in code here as it keeps changing what I am putting in, and I can’t edit my comments.

    I uploaded a txt file http://anointed.net/downloads/timthumb.txt with the functions I am using.

    If someone could take a peek and give me some direction, I would really appreciate it as I am still trying to learn php.


    1. Hi Peter – unfortunately “where” you place this code will differ from theme to theme, so I can’t tell you where specifically. I would recommend asking the original theme author if they will help you integrate this as they will know how to do it the best.

  8. Hi,

    I’ve been working with James on the above post. We successfully got the script working on MU. Came across another problem though


    It’s pulling in the posts from the blogs to the main page fine, but the thumbnail script doesn’t seem to work in this instance. Does anyone have any ideas on how to fix this problem


  9. Trying to get this to work on a site that I am developing. Rather then using a custom field, I am using the awesome catch_that_image function. Having a few issues, wondering if anybody has thoughts on how to get my code to work…

    Here it is on PasteBin


  10. Pingback: » Using TimThumb with Wordpress MU
  11. Hey Ben! Thanks for this! I’ve been struggling for timthumb to work on wpmu and it finally does!

    I implemented this for the The Morning After theme, because the plugin it natively uses totally meses up wpmu to the point that when activated the Dashboard is completely unaccessible! So I tried using timthumb and I noticed the url problem.

    I had to edit your function only slightly:

    $theImageSrc = ‘/wp-content/blogs.dir/’ . $blog_id . ‘/files/’ .

    I have been working two weeks to get proper Thumbnails on my site!
    Thanks again!

    1. Hi Alec, glad it works for you. And thanks for the tip for getting TimThumb to work on your site. I can see that being useful for other people as well.

    2. Alec, I’m also struggling with timthumb on my wpmu site. Could you tell me what previous code on your theme you had to replace with the function Ben outlined?

      1. Hey, Peter. I changed the single line I posted on my previous comment.

        A lot of people have trouble getting timthumb to work. The best way to go is to identify first if the script itself is not working or if the problem lies with your hosting company.

        1. Put timthumb on your root folder. Create the cache folder.
        2. Copy a random image to you root folder.
        3. Now call the image from your browser using timthumb http://www.domain.com/timthumb.php?src=/image.jpg&zc=xxx&h=xxx&w=xxx

        If it works but it doesn’t work in your theme it’s because of wpmu’s strange url system. That’s where Ben’s code comes in handy! At first it still didn’t work but it was only a question of adding “/wp-content” to the full path. See my previous comment.

        I am calling the thumbnails in my theme thus:

        <img src="/timthumb.php?zc=1&w=470&h=175&src=" />

        I am with Hostgator. When I first used timthumb with the Theme “Magazeen” it worked. Then I switched to Mimbo, the theme is was actually developed for and it stopped working. Odd. That was with the “normal” wp, not wpmu! Then I decided to go for the theme “The Morning After” with wpmu but using timthumb instead of Post Thumb Revisited. With Ben’s code – thanks again, Ben! – and this advice http://code.google.com/p/timthumb/issues/detail?id=8#c16 my problems were solved!

  12. Ben,

    Could you clarify – where do I put the followings: (Do I have to replace something else in the process?)

    “function get_image_path ($post_id = null) {
    if ($post_id == null) {
    global $post;
    $post_id = $post->ID;
    $theImageSrc = get_post_meta($post_id, ‘Image’, true);
    global $blog_id;
    if (isset($blog_id) && $blog_id > 0) {
    $imageParts = explode(‘/files/’, $theImageSrc);
    if (isset($imageParts[1])) {
    $theImageSrc = ‘/blogs.dir/’ . $blog_id . ‘/files/’ . $imageParts[1];
    return $theImageSrc;

    1. Peter, you have to copy that code into your theme’s functions.php file.

      Some code in my last post wasn’t rendered correctly. I call the thumbnails thus:

      Ben, if the code is still not correctly rendered, could you edit my comment? Thanks.

      1. Hi Alec,
        Thank you for suggesting that test.
        It does indeed work on my server, but I can’t get it to work in my theme (Magazine Basic – WPMU)

        This is the code I added to function.php

        function get_image_path ($post_id = null) {
        if ($post_id == null) {
        global $post;
        $post_id = $post->ID;
        $theImageSrc = get_post_meta($post_id, 'Image', true);
        global $blog_id;
        if (isset($blog_id) && $blog_id > 0) {
        $imageParts = explode('/files/', $theImageSrc);
        if (isset($imageParts[1])) {
        $theImageSrc = '/wp-content/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
        return $theImageSrc;

        Where do I put bit?

      2. Hi Alec,
        Thank you for suggesting that test.
        It does indeed work on my server, but I can’t get it to work in my theme (Magazine Basic – WPMU)

        This is the code I added to function.php

        function get_image_path ($post_id = null) {
        if ($post_id == null) {
        global $post;
        $post_id = $post->ID;
        $theImageSrc = get_post_meta($post_id, 'Image', true);
        global $blog_id;
        if (isset($blog_id) && $blog_id > 0) {
        $imageParts = explode('/files/', $theImageSrc);
        if (isset($imageParts[1])) {
        $theImageSrc = '/wp-content/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
        return $theImageSrc;

        Where do I put THIS bit?

        img src=”/timthumb.php?zc=1&w=470&h=175&src=” /

    2. Hi Peter – sorry I didn’t respond earlier. The code you have posted looks like it should function correctly. Do you have a link I can look at to see if I can suggest anything else?

  13. Thanks Alec,

    I have isolated the issue and it is definitely timthumb having trouble working with WPMU. As Ben stated above, the more correct view is that the theme author did not design it to work for WPMU. I followed your suggestions Alec but still unable to get the theme to work. I think my php is not good enough to fix this. After 6 days, I’m cutting my lost and looking for a different theme. Thanks again for all your time and help.

  14. I’m a design and not a developer but I’ve been asked to work with the Arras theme and I can’t get the Timthumb.php to work. I’v tried everything and I’m slowly loosing my marbles! If there is anyone that could help I would be grateful. The site is still work in progress and hasn’t a domain yet. So if you can contact me directly I will pass the access details on by mail.

    If I can’t get the site working I’m going to need to change themes which at this stage isn’t the best solution. Or if you can tell be the easily way to disable this function, that would also be great.

    thanks nik

    1. Hi Nik – There is a contact page in the footer of my site 🙂

      I tried visiting your site but it seems to require a login to view anything. If you can send me a working link to your website and an ftp login then I should be able to get TimThumb working really quickly.

  15. Hi Ben, sorry to post comment bunch like this. regarding last comment on this post, my timthumb script cannot use full domain url (starting from http). if src=/wp-content/ then it’s fine. but if start from http://domain.com/wp-content/uploads/image.jpg it will return no image. i’m googling around for this for whole day today. thanks for help. I really appreciate your time.

    1. Not to sound like a dick, but it sounds pretty self explanatory to me. If your using custom fields simply remove domain.com from the field, ie. /wp-content/uploads/image.jpg

      Or alternately, not positive as I use the method above, add your domain to “$allowedSites” on line 546.

      1. Not to be a dick but your self explanatory solution doesn’t work for WPMU subdomains since each blog is created in a different directory folder such as: wp-content/blogs.dir/1/files/2010/01/logo-300×67.jpg which can be a real pain in the ass if anyone expects their computer illiterate customers to upload an image and then figure out what blog/year/month folder their image resides.

      2. As far as I am aware it does work in that format. This problem only occurs if the theme is poorly developed. If you use my own theme, Elemental, then the image urls are automatically detected and the computer illiterate clients don’t need to do anything besides upload an image.

  16. Pingback: 250 Excellent Blog Articles for Web Designers | Advertising News
  17. I’ve been working on trying to get this to work with a theme all day long with no luck so far.

    Basically I am trying to write a function that will grab the first image in a post, so that I can reference that function within the template for timthumb to make a call to it.

    Could you please provide a simple function that will search a post for the first image, and return a url that can be used with timthumb?

    I did manage to use your function to successfully grab the thumbnail if it’s defined as a custom field, but would like to expand that to simply search the post for the first image instead.

    that is where I keep getting stuck.

    thanks so much for your time

  18. How would I go about adding this to “WooTube Theme”? I have tried numerous times and failed.

    Here is the code:

    function woo_get_image($key, $type, $width = 0, $height = 0, $class = “thumbnail”, $quality = 90) {

    global $post;
    $custom_field = get_post_meta($post->ID, $key, true);

    if($custom_field) { //if the user set a custom field ?>

    <a title="Permanent Link to ” href=””><img src="/thumb.php?src=&h=&w=&zc=1&q=” alt=”” class=”” />

    <a title="Permanent Link to ” href=””><img src="” alt=”” class=”” />

  19. Hi,

    I’m ussing news theme from studiopress. I have a wordpress MU installed on my root folder as subdirectories.

    The news theme has a file named timthumb.php and in the main page has this code:

    have_posts()) : $recent->the_post();?>
    ID, “thumb”, true) ): ?>
    <a href="” rel=”bookmark”><img class="thumb" src="/tools/timthumb.php?src=ID, “thumb”, $single = true); ?>&h=&w=&zc=1″ alt=”” />

    Could anyone help me please please, i’m willing to pay something (my budget is tight) to fix this,


  20. Okay, I take that back. I discovered something interesting to point out.

    I looked around for the cache directory that stores these thumbnails, figured out it was set to 755. It is located under [theme_directory]/cache – I chmod the directory to 777, BAM, works. Why does it not work with 755? How can I make it so that it works automatically without having to chmod the directory every new theme???

  21. hello Ben! i would like to ask a question. im using the infamous original premium news wordpress theme. the problem is about the infamous FEATURED feature… not showing the image and such. i used the timthumb script, it worked on my offline wordpress site. But its not working on my online wordpress site. my host is 000webhost. could it be about the host? thanks! 😀

  22. What if the theme I’m using (studiopress’ agent theme) uses several different custom fields?

    The “thumb” field is used for the home page (I have this working with the code here), but the listing page uses a custom field and each is numbered:

    How can I incorporate all of these fields into the code? If I take the line:
    $theImageSrc = get_post_meta($post->ID, "thumb", $single = true);
    and change it to
    $theImageSrc = get_post_meta($post->ID, "_photo_1_large", $single = true);
    then that particular custom field works. So (because I’m a terrible coder) how do I edit this code to be able to work with multiple fields?

    Whew, thanks for even reading this far!

    1. I’d change the get_image_path function to accept some extra parameters

      get_image_path ($post_id = null, $fieldname = ‘Image’) {

      and then change the get_post_meta command

      $theImageSrc = get_post_meta($post_id, $fieldname, true);

      then you can tell each area which custom field to use

  23. Thanks for the reply! I’m stoked to get a response.
    I’ve updated the get_image_path as you specified and indeed when I set the $fieldname to any of the custom field names I get the desired results…

    But alas, I am still too ignorant to see how that allows me to do multiple items. Can I create an array for $fieldname? Should I simply specify the custom field somewhere else in the code? I will find the answer to this! Of course, any more guidance you can offer is much appreciated.


    1. I am afraid I don’t know how the theme is made so without seeing it being used I can’t really suggest any more.

      What I would do is look through the templates for where the thumbnail is being inserted and then call the get_image_path function in the correct location changing the fieldname depending upon what is required.

  24. Hi Ben,

    Any chance of doing a video tutorial? The lingo is all new to me so being able to see someone actually go through the motions is a big help.



    1. I don’t think this is practical. Every theme is different so making the customisations for one theme would not work in another theme so any video would have to be done for every theme. I should think most programmers will be able to work through the description I posted above and if there is anything in particular that’s not clear just let me know and i’ll see if I can clarify what I mean.

  25. To anyone who can help fix timthumb:

    Here is the php code that calls timthumb:
    <img src="/timthumb.php?src=ID, “image_value”, true ); ?>&w=320&h=320&zc=1″ />

    Here is the file post-image.php:
    ‘post_type’ => ‘attachment’,
    ‘numberposts’ => 1,
    ‘post_mime_type’ => ‘image’,)))
    foreach( $images as $image ) {
    $attachmentimage=wp_get_attachment_image( $image->ID, $size );

    echo ”.$attachmentimage.apply_filters(‘the_title’, $parent->post_title).”;

    function getimage($size=medium) {
    if ( $images = get_children(array(
    ‘post_parent’ => get_the_ID(),
    ‘post_type’ => ‘attachment’,
    ‘numberposts’ => 1,
    ‘post_mime_type’ => ‘image’,)))
    foreach( $images as $image ) {


    return $attachmenturl;


  26. Can someone please help me. I am relatively new to wp & with my theme, i am running into this issue–the thumbnails wont appear because i am using wpmu. I know this post is the solution, but i just can’t work it out into the code. any specific guidance would be amazing. really, all i want is to get my site running. i need to know where exactly the code goes and what needs to be replaced. sorry for being wp illiterate, but im trying to learn.

    thanks so much. any help would make my day =)

  27. I am using this with wpmu just fine, but I just ran into an issue I can’t seem to solve.

    My primary install is xyz.com using subdirectories, so I would have an account 123.xyz.com

    Doing that works perfectly.

    Where I run into problems is when I use the domain mapping plugin. This results in ‘remote host not allowed’ errors.


    Notice the thumbs do not show. Yet if you open the thumbnail image in another window you get the error about remote hosts not allowed.

    Now if I change the url to the 123.xyz.com instead of the mapped domain, then the image shows up.

    What is the solution to this?
    (what is really strange is it was working perfectly until today. The only change I made was adding in the members plugin. Even uninstalling the plugin makes no difference, so really I have no idea why it just stopped working all the sudden)


  28. To add to my comment about domain mapping above:
    If I try to add in the ‘mapped domain’ to the timthumb file, then it tries to create the thumb in the directory which of course does not work, because the file is already on the server.

    Basically the problem is only with mapped domains in wpmu

  29. I am calling images with a custom field and I have used Timthumb in the past to size them, etc. I know that MU has trouble dealing with the url path to the image and I have found this ::: http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/ although I have not been able to get it to work, i am hoping someone can look at my code and give me some suggestions.

    First, I am calling custom field like this::: the image gets pulled from a custom field called Thumbnail, and I want to use timbthumb to size the image. When I put a direct path to the actual MU uploaded image it works http://domain.com/wp-content/blogs.dir/1/files/2010/02/… But I would to make it so I can just upload the image and not deal with finding that path, etc… so here is my call for the custom field.
    ID , 'Thumbnail' , false );?>

    <img src="/timthumb.php?src=&h=300&w=550&zc=1" alt="" width="600" height="300" />

    Then, I placed this code into the functions.php file

    function get_image_path ($post_id = null) {
    if ($post_id == null) {
    global $post;
    $post_id = $post->ID;
    $theImageSrc = get_post_meta($post_id, 'Image', true);
    global $blog_id;
    if (isset($blog_id) && $blog_id > 0) {
    $imageParts = explode('/files/', $theImageSrc);
    if (isset($imageParts[1])) {
    $theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
    return $theImageSrc;

    Now it did not work, I am pretty sure I need to modify some code here, can anyone suggest what can be done with what I have going here? Thanks a ton… I feel like I am close but not quite there.

  30. Anyone get this working with Woos Newspress theme?

    Just wanted to thank Ben by the way. Very saddend that woo (Woothemes)would not help in this case :'(

  31. Using “premium news” wootheme.

    What am I missing? I added the code from this blog to the Functions.php file.

    I then changed the code in the default page

    <img src="/thumb.php?src=ID, “image”, $single = true); ?>&h=57&w=100&zc=1&q=90″ alt=”” class=”th” />


    <img src="/thumb.php?src=&h=57&w=100&zc=1&q=90″ alt=”” class=”th” />

    Yet now it outputs
    “no image specified”

    What am I missing?

  32. I noticed the issue when I moved over and all thumbs were grey blocks (they still are). When however I rightclick on one and then choose “view image”…. it downloads timthumb.php. I mean really the php file itself which then resides on my harddisk.

    See: http://farmvillechicken.com unless you read this after a day then hopefully I have coded something. I have posted a thread in the forum of the theme I am using hopefully someone will create an update for it: http://swiftthemes.com/forums/showthread.php?435-TimThumb-php&p=1460

    THANX for the blogpost! took me a long time before I found this post, but definitely worth reading the post and the comments.

  33. Ben,
    Thanks for this wonderful plugin. I have managed to integrate it very successfully with my theme, Suffusion.

    However I am facing a few hiccups with getting it to work with MU. The point where I believe it is failing is the check for $blog_id, I believe. Based on your code, if we are on MU only then $blog_id will be existing and non-zero. However when I try this with my regular WP installation it returns a value of 1. Ideally this wouldn’t have been a problem, because the subsequent condition, exploding $theImageSrc on the “/files/” wouldn’t work in a WP installation, so the file source will remain untainted.

    Where I am facing a problem is that I had changed the back-end file paths in the actual script to write to the “uploads” folder. So my “cache” and “temp” folders are both in “uploads” in a WP installation. I guess you can see where this is going – since the paths on my back-end are different from what you have in the script by default, I have to change the path if the installation is of MU. Unless there is a foolproof way of determining if the installation is a WP or a WPMU installation, this cannot be done.

    To cut a long story short my question is whether this can be conclusively determined? Or should I wait for version 3.0 of WP? I did see your post on WPTavern, where you too were looking for a concrete method to draw the distinction between WP and MU.


  34. Hi,
    I don’t know if anyone is still looking at this thread.

    I’m running my wpmu site on MAMP currently.
    I’m having trouble getting this solution, which I can see should work, to work. I tried the test suggested above and timthumb is in theory working on my site.I know it is the file path of the image that is causing me problems.

    I have a very basic (read:stupid) question:
    After I place the function in functions.php,
    do I call the function in the document itself? Like get_image_path () or something?

    And then do I put the $theImageSrc variable in the image tag with php echo?

    Probably not, since it’s not working for me, but I have the feeling I’m missing something glaringly obvious here.

    If anyone has what I think is probably a quick answer to this, I’d really appreciate it! Please forgive my vague notions of php usage.

  35. Hi there,

    I still can’t get this work. I have a WP site with the Premiumnews theme installed form WOO Themes.

    Sometimes the thumbnails don’t show up. Has anyone an idea to fix this?

    1. I actually spoke to the guys at Woo about this. Have you tried asking them how to integrate it? They should be able to help you on their support forums.

      1. That is the problem, this is a free premium template sow i don’t have acces to their support forum. Does anyone have a solution for this?

        Thanks in advance.

  36. Pingback: Spotlight Ideas » 250 Excellent Blog Articles for Web Designers
  37. timthumb is not getting internal or external images on the header preview!

    how do i get it working for the theme?

    this is the header.php code:

    $xPicture = substr($xPicture, $xStart, $xEnd);

    if(@fopen($xPicture,”r”)) {

    $xPicture = get_bloginfo(‘template_directory’).’/scripts/timthumb.php?w=320&h=246&src=’.$xPicture;

    }else {

    $xPicture = $xPicture;


    this is the functions.php code:

    if(!file_exists($wud[‘basedir’].”/script/timthumb.php”)) {

    copy(TEMPLATEPATH.”/scripts/timthumb.php”, $wud[‘basedir’].”/script/timthumb.php”);


    this it the code in the browser that does not work:


  38. hi,

    In my wordpress mu site blog im using newscast theme, then i use sitewide tags to display all the post in my sub-blogs to main blogs. my problem is the thumbnails are not displaying in my main blogs also the image in the homepage slider and not displayed. someone can help on how to work this issue?

    I hope you can help in my problem 🙂



  39. Anyone with the Hyperion theme from themeforest been throu this?

    I’m trying to find where to add the code!

  40. Been messing around with this for the whole day!!
    Hi, this really makes me pull chunks of hair of my head!!
    And the people from themeforest whom I bought the theme from are to busy giving me direction on where to add the code!

    In the root of my theme folder there is a file named functions.php
    I tried to add the above code in that???
    This file contains small amount of coding.
    // Set path to theme specific functions
    $functions_path = TEMPLATEPATH . ‘/functions/’;

    require_once ($functions_path . ‘theme-options.php’); // Options panel
    require_once ($functions_path . ‘theme-comments.php’); // Custom comments
    require_once ($functions_path . ‘theme-shortcodes.php’); // Theme shortcodes
    require_once ($functions_path . ‘theme-widgets.php’); // Widgets
    require_once ($functions_path . ‘widget-func.php’); // Widget specific functions
    require_once ($functions_path . ‘sidebar-init.php’); // Register sidebars

    The timthumb.php is in the following direction
    /themefolder/inc/timthumb.php the timthumb version I’m using is this one.
    http://www.binarymoon.co.uk/2009/07/timthumb-beta-test/ I really need to get this timthumb thing to work 🙁

    I understand if it’s varies from one theme to another but atleast a hint on what I should look for. and what the code I should edit, might look like or at least in what file it most likely should be.

    Thanks a lot!
    Namaste/ appleseed

    1. You need to find out how your images are embedded currently before being able to make this work. I assume the images are already being resized, in which case you need to work out how the timthumb url is being generated, and then modify the code that does the thumbnail url generation. If the thumbnail path is created in the templates themselves I would turn them into a function that can be reused so that you only have to make changes in a single place.

  41. thanks for this!

    i added the code to functions.php and edit some of the suggested code
    i change

    $theImageSrc = get_post_meta($post_id, 'Image', true);


    $theImageSrc = get_post_meta($post_id, 'thumbnail', true);

    the 2nd parameter is the custom field,

    then i look into my wordpress template and check where the timthumb.php is being called and then i call the function get_image_path();

    sample code:

    <img src="/timthumb.php?src=ID,"thumbnail",true);?>&h=192∓w=216&zc=1" alt=""/>

    replace it with

    <img src="/timthumb.php?src=&h=192∓w=216&zc=1" alt=""/>

    1. you need then to call the get_image_path function at the src. So you will replace you code with :

      src= <img src="/timthumb.php?src=&h=192&mp;w=216&zc=1" alt=""/>

  42. Hello, I am having an issue with this script. I have used the fix but I cannot seem to get it working. I am using the WordPress Thumbnail option, can I possibly fix it or do I need to use the Meta option. Thank you in advance.

  43. Pingback: What To Do Or Consider After You Enable Multisite In WordPress
  44. Can anyone help with the Scarlett theme? I cannot get the slide panel at the top to show images. I thought it was the timthumb file, but I have downloaded and replaced with the newest version. http://www.socialmediabuzz.org if you want to see what it is doing (or NOT doing, lol).

    Any suggestions appreciated!

  45. Hi, great post, but I am having trouble utilizing the Tim Thumb script for my blog. It seems whenever it auto crops and resizes the image, the file is always so big, if you can see on http://wordpress.themeshq.net/ . It is not that big of a deal, but as we know, google implemented in April speed into its algo, so anything to speed it up will help!


  46. Ok. I’m no PHP expert so I’m looking to understand the code above. When I implements similar code on a multisite install the main blog (or site) with ID=1 is supposed to show images from the other blogs but $blog_id is always ‘1’ on the main blog cos that’s its ID.

    Is the code above supposed to work in such a scenario (use the correct Blog ID where the image is from) or it only works if I’m in Blog 1 then $blog_id=1, Blog 2 then $blog_id=2, etc so on those sub-blogs (sub-stes) it will work but will not work on posts from other blogs.

    Hope my ques makes sense??

  47. Hello,

    does anybody use this hack into eleganttheme template AND wordpress 3 multisite? I have big problem to integrate with ePhoto from eleganttheme – could anybody help me with this?


  48. I’m not able to get it working on my site neither. I have these ugly thumblnails that say “No Image” and can’t seem to get rid or edit them. 🙁

  49. I’m afraid to say I’m completely stumped on this, my timthumb actually generates a working adress, but it won’t show the actual images 🙁

  50. I’ve been trying this script to no avail. I’m got an image path that looks like “http://mysite.com/wp-content/uploads/2010/09/companylogo.png” that is set in a Theme Options page. I’ve modified your code above to be:

    function get_company_logo() {
    $theImageSrc = get_option('ipr_company-logo');

    $imageParts = explode('/files/', $theImageSrc);
    if (isset($imageParts[1])) {
    $theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
    } else {
    $theImageSrc = "explode didn't seem to work";

    return $theImageSrc;

    Running this function, the result I get always is “explode didn’t seem to work”. Basically, the function never “sees” a “/files/” segment in the URL, so it doesn’t have anything to “explode”. Is that correct? What am I doing wrong?

    This is a ground-up custom theme I’m building. The reason I’m using it this way (instead of the built-in thumbnail resizer) is that I want it to be very user-friendly for people to set a company thumbnail to use on the site and don’t want to force them to set it on a “home” page or something like that (which would be unintuitive).

    I’m running WordPress 3.0.1 as a multisite install.

    Any info/advice would be much appreciated! Thanks!


  51. Hello,
    i’ve to use TimThumb to my WordPress MU blog, here is the actual code that does not work:

    ID, ‘blog_thumb_image_url’, true);

    post_title; ?>

    <img src="/timthumb.php?src=&h=300&w=460&zc=1″ alt=””/>

    post_content)), 300); ?>

    <a href="guid, ‘quick_view=1’); ?>” class=”quick_view”><img src="/images/icon_quick_view.png” style=”width:16px” class=”mid_align”/> Anteprima
    <a href="guid; ?>” title=”post_title; ?>”>Leggi l’articolo

    How I’ve to change it, to make the preview of images work?
    Thanks a lot, Rocco.

  52. Pingback: TimThumb troubleshooting help
  53. Thanks for all your help on this everyone:-)

    For those of you who are wanting to get this working from the ‘set feature image’ function in posts try:

    function get_image_path($post_id = null) {
    	if ($post_id == null) {
    		global $post;
    		$post_id = $post->ID;
    	$thumbid = get_post_thumbnail_id($post_id);
    	$theImageSrc = wp_get_attachment_url($thumbid);;
    	global $blog_id;
    	if (isset($blog_id) && $blog_id > 0) {
    		$imageParts = explode('/files/', $theImageSrc);
    		if (isset($imageParts[1])) {
    			$theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
    	return $theImageSrc;


    <img src="/timthumb.php?src=/&h=51&w=51&zc=1" alt=""  style="width:51px; height: 51px;" />


    1. Hi Mart,

      $imageParts = explode(‘/files/’, $theImageSrc);

      In this line what is that /files/…..
      Is that the path of image where the images are stored?


  54. hi there,

    The paragraphing of (indentation) of the image and it’s short description is not appropriately alligned as you can see in my website (under recent post). Is it because I just upgrade my WP to the latest ver 3.02?

    How can i fix it so that all thumbnails will be aligned correctly at the left side? not alternately like in my web.

    Thanks in advance.

    1. Hi – this has nothing to do with TimThumb or WordPress. It’s all down to your theme and the content. I would suggest talking to the theme author as there’s nothing I can do to fix it.

  55. Pingback: Verve Meta Boxes – Wordpress Multi Site Timthumb fix « Rein Aris – Blog
  56. I’m completely stumped. I’ve dealt with the WPmu issues before and no where all of this is coming from. Then my page source would display img src=”path/to/timthumb src=path/to/image.jpeg&w= h= or something of the like, with no images being displayed.

    However, I’ve moved to a different server and initially had normal WP, and it wasn’t working, then moved to WPmu. The problem I’m having now is that in my page source I get the path to timthum, but nothing shows up in the image path. Is there some kind of easy fix for this?

      1. I know, that’s the problem. In my index.php file, the script has:

        (? echo $image; ?)

        after the timthumb.php source. I have this same exact theme and site running on my mamp system from my computer and it works fine. For some reason the echo image command is not working and I’m not sure if it’s timthumb or something else. I’m not sure what the deal is.

      2. The problem is the theme. TimThumb has nothing to do with what is displayed in the html – all it does is resize the image. I would ask the theme developer for help.

  57. Thanks for all of your help! My fiance actually got it working last night. I had changed permissions to the scripts folder for timthumb.php and it didn’t work. Then I updated timthumb. My fiance tried to change the permissions again and it did work.

    The image source problem was actually with the php function: . I swapped that out with a different function and it began to call the image source.

    Thanks again for all of your help. Its always hardest when there are multiple problems. It turns out that the image path and the images not showing were separate issues.

    1. Hi Melissa,

      Can you show me what you have changed in php functions.

      where i have to include the image path in timbthumb.php?
      What you have updated in timbthumb.php.

      Please its urgent.


      1. Hi – you don’t change anything in TimThumb itself. Update the script to the latest version and make sure directory permissions are set correctly. Editing the theme is the important part but you’ve give no information about your website or theme. As long as you followed the tutorial you should have the basics sorted.

    1. Looks like it’s all working to me? Photos should not be loading from localhost, that’s a theme/ WordPress settings and is not a problem with TimThumb itself.

  58. I use a Classico theme I just purchased from ??? I’ve been working with the theme developer to get both feature images and the slider to display to no avail. After checking he suggested removing Timthumb and then sent me here. Here’s a little info on the setup:

    WPMU 3.0.4 + BP 1.2.7
    Parent site: djohnsonfam.com – Images show no problem
    My site: http://djohnsonfam.com/marvc – Feature images and slider images don’t display.

    Stumped as I’ve wasted money on a “premium” template and have no clue other than moving over to another theme and cutting my losses. I have access to Elegant Themes but haven’t been able to locate a 2-column / 4 column footer template. What I’m wondering is if anyone here can take a look and determine if the issue is with Timthumb or the theme itself? If Timthumb then I’ll put forth an effort and try the fix mentioned above.
    Any responses appreciated.

      1. Having the same issue with a new WPMU install at http://spreadable.info and the sub-domain http://infonode.spreadable.info. The sub-domain site is not displaying the thumbnail on the home page for the re-sized image on the sub-page. I know this is a “passing the sub-domain” issue and have read your answer link, but do not know where to add the code to the timthumb.php to make it work. Thanks for any suggestions.

      2. Hi Ken – the code needs to be added to the theme rather than TimThumb, I would suggest looking in there to make your change.

  59. Walking thru this now:

    1. Here’s the error I get after right-clicking and attempting to view one of the broken post images:

    Fatal error: Call to undefined function cleanSource() in /home/content/n/u/s/nusolutions/html/djfamily/wp-content/themes/Classico.marvc/functions/timthumb.php on line 77

    2. Created ‘temp’ directory and set permissions on it and the ‘cache’ folder to 775.
    Same issue.

  60. What I don’t understand is why timthumb would prevent me from adding my own cropped images. For instance the logo. I changed and uploaded my own but it doesn’t show. At worse case the image should still appear giving me the ability to crop or resize as I see fit.

    1. Hi Ken, I’m afraid I don’t really have the time to make the changes to your site at the moment. The actual fix for this issue is relatively straightforward but the implementation will vary from theme to theme. The best thing to do would be to ask Themelab to implement the change as this will help all of their customers.

  61. Tim Lee January 23, 2011

    I’ve come up with a different approach to this, and wanted to know what you guys thought. I figured the worst thing I could do is make any assumptions, so I created a function to convert a url to a local path and vice versa:

    function simplyit_admin_framework_convert_path($input) {
    $site_url = get_site_url();
    $site_dir = untrailingslashit(ABSPATH);
    $uploads = wp_upload_dir();
    $dir = strpos($input, $site_url);
    $url = strpos($input, $site_dir);
    // Check if $input is a url
    if ($url !== false && $dir === false) {
    $output = str_replace($uploads[‘basedir’], $uploads[‘baseurl’], $input);
    if ($input == $output) {
    $output = str_replace($site_dir, $site_url, $input);
    // Check if $input is a dir
    } elseif ($dir !== false && $url === false) {
    $output = str_replace($uploads[‘baseurl’], $uploads[‘basedir’], $input);
    if ($input == $output) {
    $output = str_replace($site_url, $site_dir, $input);
    // Else return input untouched
    } else {
    $output = $input;
    return $output;

    Which then gives you the local path to the file then I use something like this to get the src that I give to timthumb:

    str_replace(WP_CONTENT_DIR, ”, $image_local_path)

    What do you guys think of that? Do you see any problem with it?

    1. Interesting, I will need to take the function apart to see if I can work out what it does, but based upon what I’ve worked out so far it certainly looks like a nice alternative.

  62. For anyone who is interested, I’ve come up with what I believe to be a universal solution for timthumb that will work on WordPress Multi Site, WordPress MU, and on Standard WordPress installations even with custom wp-content, and upload directories.

    get_timthumb($input, $args) {
    $site_url = get_site_url();
    $site_dir = untrailingslashit(ABSPATH);
    $uploads = wp_upload_dir();
    $timthumb_source = '/path/to/thimthumb.php'; // Insert Path to timthumb.php
    $timthumb_args = '&' . $args;
    if (is_array($args)) {
    $timthumb_args = '&' . str_replace(array('height', 'width', 'quality', 'zoomcrop'), array('h', 'w', 'q', 'zc'), http_build_query($args));

    // Convert $input into local path, if it isn't already
    $input_dir = str_replace($uploads['baseurl'], $uploads['basedir'], $input);
    if ($input == $output) {
    $input_dir = str_replace($site_url, $site_dir, $input);

    $output = $timthumb_source . str_replace(WP_CONTENT_DIR, '', $input_dir) . $timthumb_args;

    //By Tim Lee - http://simplyitpro.com


    'width' => '200',
    'quality' => '100',
    'zoomcrop' => '1',
    <img src="">


    'w' => '200',
    'q' => '1',
    'zc' => '1',
    <img src="">


    <img src="">

    If anyone has any questions or suggestions, feel free to let me know, anyone who wants to use this abviously can as well. The only required change to use this is to enter the location of the timthumb.php file you are using.

    1. Hi Tim Lee
      I’m not advance in this things.
      Can you tell me the writing code for dummies?
      I had trie to put the code but I don’t know exactly where and if I should use a clean timthumb.php or incremented by Ben Gillbanks

      1. This requires no editing of timthumb.php (so use a clean one),

        1. Put this function anywhere inside your themes functions.php (make sure you enter the url to your timthumb.php file) :

        function get_timthumb($input, $args) {
        $site_url = get_site_url();
        $site_dir = untrailingslashit(ABSPATH);
        $uploads = wp_upload_dir();
        $timthumb_source = '/path/to/thimthumb.php'; // Insert URL to timthumb.php
        $timthumb_args = '&' . $args;
        if (is_array($args)) {
        $timthumb_args = '&' . str_replace(array('height', 'width', 'quality', 'zoomcrop'), array('h', 'w', 'q', 'zc'), http_build_query($args));

        // Convert $input into local path, if it isn't already
        $input_dir = str_replace($uploads['baseurl'], $uploads['basedir'], $input);
        if ($input == $output) {
        $input_dir = str_replace($site_url, $site_dir, $input);
        $output = $timthumb_source . str_replace(WP_CONTENT_DIR, '', $input_dir) . $timthumb_args;

        //By Tim Lee - http://simplyitpro.com

        2. Insert this code wherever you want to use timthumb (in this case it’s in an img tag):

        $img_src = 'http://somesite.com/path/to/image.jpg';
        $args = array(
        'height' => '200',
        'width' => '200',
        'quality' => '100',
        'zoomcrop' => '1',

        (Due to this sites filters I cannot use actual php tags in my comment, so replace [php] with an opening php tag and [/php] with a closing php tag) Also the $args variable can contain any parameter timthumb can handle.

        If you have any additional questions let me know.

        – Tim

    2. again the filters wouldn’t print it:

      get_timthumb($img_src, $args); enclosed in php opening/closing tags and inside an img tag.

    1. Hi – the changes need to be added to the functions.php file. No changes need to be made to TimThumb. Unfortunately the fix is not as simple as just copying and pasting the code, you need to alter the references to the TimThumb images as well. I would suggest contacting the theme author and asking them to implement the fix in this post. That would be a lot easier and would solve the problem for everyone else who uses it.

      Also – there’s no need to post the same comment 3 times. I will moderate the posts, and reply, when I have time 🙂

      1. follow up on:

        “hi Ben! I’m really sorry about my posting attitude… i am just so desperate on my situation. I have been puzzled on this for 2 weeks now.. But i am so glad and happy for your advise Ben, you give me hope..I already contacted the MediaPress theme author about 3 days ago but until now no response yet. i am so sad about it, i am waiting desperately. Can you show me some links on how to alter Ben? A tutorial perhaps? I just want to take a try on this one..hoping to solve the problem sooner. I just don’t know if the author cares to respond my situation. Bad choice…Thanks Ben…”

        To the MediaPress theme author DDStudios: I am really happy that he is doing things right now to solve the problem not just mine but as general…and i deeply apologize for my acts if it cause some troubles. I think i am just to helpless on my problem. But now that the Author is acting on this matter, i’m so excited.. And a thousand thanks to Ben for being so cooperative and always there to help.. Thanks a lot and more power…

      1. I cant get it to work with timthumb at all. everyone is telling me it cant. are you working on an update or do we need to find another image sizer solution?

      2. Everyone is wrong I’m afraid. TimThumb works with WordPress mu and WordPress multisite. As described in the article, the issue is your theme, not TimThumb. TimThumb does not need any updates in order for it to work.

        You have to remember that TimThumb is not part of WordPress. It’s not a WordPress plugin, and it does not need WordPress to function. All it does is resize the images that are given to it. If you give it bad urls then it won’t resize the images, so you need to make sure you pass the correct parameters.

  63. Im sorry i didnt make myself more clear, its not my themes it is timthumb. I use a code to grab the first image of every post on all 17 of my themes in my store. This is what everyone is saying i can no longer do with timthumb. For the types of themes i make custom fields and post thumbs just arent a good way for my customers to do it.

    I need to be abloe to grab the forst image of each post, and use timthumb with it.

    Thanks for the reply mate.

    1. Hey Eric, It’s still your themes I’m afraid.

      What happens is you’re grabbing the url of the first image. That’s good, however the images on WordPress Multisite are incorrect, they are virtual urls. If you enter the url for an image into your browser you will see it, however try to find that image on your server and it won’t exist, at least not in the location that WordPress gives you. What the code in this tutorial does is convert that incorrect url, into one that is correct on the server. TimThumb needs to know the server path of the image relative to it’s location, so if you give it the path for an image that doesn’t ‘really’ exist, it will just tell you the image does not exist.

  64. But how do i use the code above when its set for custom fields? i need it to grab forst image of each post, or return a image i set if no image found.

  65. I am actually going insane trying to find the right fix relevant to my theme. Have been trying to get this to work for 2 weeks. Where is the best place to pay someone to do this for me?

  66. Pingback: Simple WordPress Post Thumbnails with Regular Expressions
    1. Hi Luc – thanks for the message. Unfortunately this doesn’t solve the issue for WordPress multisite at all. It also involves modifying TimThumb which isn’t necessary since TimThumb is programmed to work for the existing website.

      1. Hi Ben – I understand that it’s most of the time the fault of the theme and if the developper integrate the script and multisite solutions well you don’t need to modify the script. But there are some developpers who don’t know how to use these fixes, and then the users can use the script from my comment which will work fine on any multisite theme. (atleast on my websites)


    2. Cant ask each client to place the url in scripts in there theme. This does not seem like a good idea. Though since no one else has shown me anything that works….

  67. Would love to still see a code snip that grabs the first image of a post and works with multisite… been waiting over 6 months now.

    1. there is an way of getting the image and works with timthumb but you’ll need to add your site to the timthumb script…

      1. Everyone keeps telling me there is a way but not one person has shown me a way. And im sorry but like i said has a theme developer making clients add their site to the script isnt the best way to do anything.

    2. I posted an article just the other day that explains how to get the first image from a post.

      As for waiting over 6 months, you first posted on here in March! Also please keep in mind that everything I have done with TimThumb and these tutorials has been done for free. I enjoy doing it and am happy to help, however I don’t have the time to fix everybodies website for them.

      If there’s anything that’s unclear in the tutorials then please explain what and I will try to explain it more clearly but I’m afraid I am not going to do the work for you.

      1. “I posted an article just the other day that explains how to get the first image from a post.” – That works with Multisite?

        I also tried the wordpress forums, contacting darren and a few other forums. Then someone let me know about this site so i tried contacting you, then posting on the site. O yea i even posted in google code on the issues section which isnt even their anymore.

  68. Like i also said before im going to try to work with the link you gave. At this point i dont care if i even have to replace timthumb im sick of going through issues with it. MS issues and external site issues have really made me throw my hands up with it.

    This is my dream script really… Id pay very well for haha,

    1: Work on both WordPress and WordPress:MS.

    2: Give a url of a default image if no attachment is found.

    3: Grab the first attached image of a post.

    4: Be able to place code in functions.php and use php tags thoughout the theme. This will require the code not to give a error when being used over and over.

    5: Must be able to define image sizes though each php call tag.

    1. I’d be willing to help you out, however I would have difficulty using these comments to do so (because it cuts off my code so much). If you want you can post a simple request on my site:

      I’d be willing to help you out for free, if you look above I’ve posted an alternative method that works universally. as far as getting the attached image, that should be pretty easy as well.

      1. I sent you a request. i sent the above statement with what i need with it also. Also i could care less if this script is based on timthumb or not, its been months now and i just want stuff to work. it seems timthumb cant do what i need it too.

  69. For the truly lazy (like me), here’s a “drop in” version that works with multisite without needing to update the theme.

    You just replace your existing timthumb.php with this one, and it automatically scans through the blogs.dir to find the appropriate file.

    [link removed]

    1. I’ve removed the link to that file. I would strongly recommend against using any system like this for a number of reasons. The biggest, in particular with that file, is that it’s a long time out of date. The latest version of TimThumb has a number of speed optimisations and, more importantly, security fixes. There are a number of bad things I could do to your website through the use of the version you are hosting there.

      1. I’ve already explained how to make it work. If you can’t make it work from the info I have given you then I don’t know what else to suggest.

        What I have shown in these tutorials is very basic stuff for anyone who considers themselves knowledgable in WordPress.

      2. No you didnt? you showed us how to make timthumb work with MS using the first image in each post while giving us a default pic if none found? link please.

      3. If you can’t work it out then that’s not my problem. I’m afraid I am not going to do your work for you.

      4. Wow i offered to pay you really, really well for a lil help. I told you what i needed and you said you posted a tut for it and when ask where? this is your response? You know damn well you didn’t post a tutorial showing anyone how to do what i posted. No reason to get all upset about it you shouldn’t have lied in the first place.

        Why on earth you didn’t just take 10 minutes out of your day, make some money and have a happy customer is really beyond me. Only thing i can think of is what im asking just isn’t doable, which you said it was… another lie?

  70. Ben – Thanks for the continued support of a great script. My multi-site issue is a little different from those discussed here.

    I have timthumb working great under Genesis child themes on a multi-site network to create thumbnails on archive pages. However, this requires me to put multiple copies of the timthumb.php script in each stylesheet folder of each subdomain. I’d like to have one copy of the script on the primary domain and then resize images on subdomains, without having to modify the script to enter multiple external sites, since that would almost be more work than having multiple copies of the script.

    Can the array for external sites in the script support wildcard subdomains? That way I could have 1 copy of the script on the primary domain.

    Thanks in advance.

    1. You can allow various subdomains by adding the hostname to the allowed Domains. In my case I could add ‘.binarymoon.co.uk’ and all subdomains under my site would work. Keep in mind though that if you are using the allowed_sites array that it will start creating multiple versions of each image, since it will have to download the images from the ‘external’ domains to the master domain.

  71. Hi all,

    Was hoping to get this fix working with the theme Black Eve.

    I’ve tried implementing the above code at the bottom of the “functions.php” with no luck.

    Hope you can help me Ben, i’ll even supply you with ftp details to help fix this issue, would really like it up and running as i need to test more than one WordPress site at a time.


  72. Hey Ben

    Man what a long thread!

    My issue is slightly different, and ive been hunting the interwebs for ages. TimThumb seems to be working fine on my site, however as soon as the page finishes loading, all the images disappear. If i right click an open in a new tab, the image is there, no probs. This happens on the front end and the back end, AND IT ONLY HAPPENS IN GOOGLE CHROME.

    Interestingly, when i change the dimensions of the image to 50×50, then the issue doesnt occur. if i go to 150×150, then some work, some dont.

    Is there anything that stands out to you as the Father of this code that could be a lead? some reason that this is happening?

    Thanks mate for all you are doing for the web dev community – this really is an amazing script!

    1. Hi Brook – this sounds like an issue with your website and not with TimThumb. The fact it works when you view the image directly tells me this. I would guess there’s some javascript that is breaking the images (since they display and then vanish). I’d start by disabling plugins and seeing if that helps.

  73. Hi!

    Unfortunately i can’t get this to work. I’m using WP MU and want to use timthumb in my themes demo mode. I have tried your function in my functions.php, and calling the image with this:
    <a href="” title=””>
    <img src="/timthumb.php?src=&w=150&h=150&zc=1″>

    I don’t use custom fields but of course the latest version of WP. So, what to do?
    Kindly Lillan

    1. hmmm the code disappered. I will give it a new try!

      <a href="" title="">
      <img src="/timthumb.php?src=&w=150&h=150&zc=1">

  74. Found a way to make it work under Blogohblog’s Big News theme:

    For example, the thumbnail should show up in … but it doesn’t! (this is exactly what happened to me using Blogohblog’s Big News theme under WordPress Multisite)

    So… what to do?

    1. Does “image.jpg” (the actual thumbnail) exist?

    Check the path to make sure. If the image does exists, then TimThumb is working, and your Host is allowing it to do so. If not, check your Host’s settings.

    2. Do all files exist? Are the paths valid? In my case I found that there is no such thing as “http://subsite.site.com/wp-content/themes/subthemblogs/thumbs.php”. The theme is rerouting the thumbnail through an unexisting file. It believes somehow that the subsite thumbnail has an equivalent path -to the site’s.

    3. Solution? Quite simple alter the code in order to reestablish the path of the subsite to the site’s. In our example, replace “<img src="http://subsite.site.com/wp-content/themes/subthemblogs/thumbs.php?&quot; with "<img src="http://www.site.com/wp-content/themes/sitetheme/thumbs.php?&quot; and leave the rest as it were.

  75. Hej Ben, Could you please help me with some issues regarding WPMU, and putting up subdomains. We want to use the Newswire theme for our subdomain as we do for our main domain. The problem is that pictures (timthumb) is not showing as we use the above mentioned theme for our subdomain. We tried to use your code and above guidance to solve the problem, but as I’m not a php-developer I don’t understand the function codes and do not know were to put your written function. Could you please help us where to post your code in the function.php.

    I can submit the entire code if you give us an e-mail.

    thx Massud

    1. Hi Massud – thanks for the message. Unfortunately I don’t have the time to help with freelance jobs like this.

  76. Hi!
    What about us who don’t use custom fields? Can you give us a hint how we are going to do?

    Kindly Lillan

    1. I would be happy to give you a pointer, but your comment is rather vague. If you don’t use custom fields how do you do it instead?

    2. Lillan,

      Here is the code that I used to make it work for me. The magic is in the “explode” function bit.

      $url = “path/to/image.jpg”;
      global $blog_id;
      if (isset($blog_id) && $blog_id > 0) {
      $imageParts = explode(‘/files/’, $url);
      if (isset($imageParts[1])) {
      $url = ‘/blogs.dir/’ . $blog_id . ‘/files/’ . $imageParts[1];

      Then reference that image with an image tag like so:

      <img src="/timthumb.php?src=&w=425″ />

      You can customize the options of timthumb.php (w, h, zc, q) from there.

  77. Wow, congratulations on the longest comment thread ever! I just wanted to say thank you for posting this and maintaining Timthumb in general… we use it in our slideshow plugin and I was baffled when a user said that it wasn’t working properly in MU. This post cleared that right up.

    1. As described above, TimThumb is not a WordPress plugin and just resizes your images; so you always need to ‘patch’ your theme (technically this means tell TimThumb a valid image path)

  78. Hi Ben, timthumb is great, however I’m having a bit of an issue with so many dev’s using it to create plugins and themes for wordpress and not making them multisite compatible.

    At the moment I’m in need of getting a plugin working that i bought, i would ask the dev to fix it up but I’m not having much success, and i know you don’t have to do a thing to help but I’d appreciate it.

    Specifically with my plugin, what am i changing it and where abouts am i changing it?

    The plugins aren’t structured the same as themes and generally lack the “functions.php” file, therefore the instructions are voided in my case.

    Is there any modification i can do the to timthumb file that will allow this to work at all? I know you locked things down after the hack attacks, but I’m really keen to make this work out. I’m not sure if i can modify the timthumb and tell everything to check ‘specfic folder’ for their files. My coding skills are fairly bleak, so i can’t interpret code too well.

    Thanks in advance.

  79. Please help me!!!!
    I am making my church web site.
    And wordpress multisite image troble!!!

    upload Path : http://samok.goeup.or.kr/wp-content/blogs.dir/7/files/2011/10/111112.png

    view Path : http://samok.goeup.or.kr/files/2011/10/11112.png

    No Image View!!!! ?..?

    I don’t understand.

    I know, i have to edit php file, but I don’t know how to , where file is, what file is!!!!

    Please help me!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *