Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

timthumb not working on WP Multisite Setup with Pluto Theme WordPress

I have purchased the theme http://themeforest.net/item/pluto-fullscreen-cafe-and-restaurant/534738 - I am also running on a WordPress Multisite setup. Unfortunately the theme is not working with WPMU due to an issue with the timthumb.php. I asked the developer of the theme if he could fix this and he recommend I visit this website.

Answers (3)

2011-11-06

Luis Cordova answers:

what is the error that you get?

2011-11-06

Christianto answers:

Hi,

The url for timthumb to be re-size should use the real/right path..
since wpmu won't use real path for image uploaded via default wp upload you should correct the path.

You can use this function to correct it, put on your functions.php..

function wpmu_image_url($src){
global $current_blog, $current_site;
if(isset($current_blog->blog_id) && $current_blog->blog_id > 0){
$wpmu_src = explode('/files/', $src );
$src = 'http://' . $current_site->domain . $current_site->path . 'wp-content/blogs.dir/' . $current_blog->blog_id . '/files/' . $wpmu_src[1];
}
return $src;
}


so for example your in your theme your resize image:
http://yoursite.com/files/2011/11/image.jpg

you can correct the path first by supplying the path to the function..
$image_url = http://yoursite.com/files/2011/11/image.jpg;
$src = wpmu_image_url($image_url);


and use the path on timthumb for the image for example:
<img src="http://yoursite.com/wp-content/themes/YOURTHEME/scripts/timthumb.php?src=<?php echo $src; ?>&amp;h=100&amp;w=100&amp;zc=1" alt="image one" />

this can be harder if your theme in using timthumb on all aspect for resize image since you have to edited one by one..

edit answer: wrong php syntax on image.. :D


dircreative comments:

where do I correct the path???

$image_url = http://yoursite.com/files/2011/11/image.jpg;

$src = wpmu_image_url($image_url);


Christianto comments:

Hi,

Sorry for my late reply, could you send the theme for me too?
Maybe I can fix it for you..

I sent you my email address.

Thanks

2011-11-06

Sébastien | French WordpressDesigner answers:

Use simply site_url() instead of bloginfo('url') in the URL of your resized image

?src=site_url()/wp-content...


dircreative comments:

where do I change this code? In my theme code? in thumb.php?



dircreative comments:

which file?


Sébastien | French WordpressDesigner comments:

Send me tour theme, i look at that


dircreative comments:

I just sent you an email to your @gmail account. Look forward to hearing from you.


Sébastien | French WordpressDesigner comments:

send me your theme, that's more easy and fast. thx


dircreative comments:

email sent.


Sébastien | French WordpressDesigner comments:

Ok
in the homapge the url of the resized image is like that
http://yoursite.com/wp-content/themes/amplify/scripts/timthumb.php?src=&w=10&h=10
so the variable src is empty !

in the homepage images are displayed by this code


<img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=
<?php if(get_post_meta($post->ID, 'accordion_image_value', true) != NULL) {echo get_post_meta($post->ID, 'accordion_image_value', true);}
else if(get_post_meta($post->ID, 'large_image_value', true) != NULL) {echo get_post_meta($post->ID, 'large_image_value', $single = true);}
else {echo get_post_meta($post->ID, 'fullsize_value', $single = true);} ?>&amp;h=340&amp;w=650&amp;zc=1" alt="<?php the_title(); ?>" />



so have you enter a value for the field accordion_image_value OR the field large_image_value OR the field fullsize_value ?
If there is no value in this fields, no image will be displayed

This value must be like that
http://yoursite.com/wp-content/themes/amplify/images/flourish_left.png