[Plugin: vSlider Multi Image Slider for WordPress] Multisite patch for vSlider to use TimThumb
-
After installing vSlider 4.1.2, no pictures would display on a subsite of a multisite. After some debugging and searches, it appears that this has been a known problem for months. I’m more than a little surprised that a fix has not been implemented by now.
The problem is that TimThumb is a generic tool and has no knowledge of WordPress directory structure. Therefore, it makes assumptions that do not work with multisite mapping in WordPress. The solution is either to use a WordPress-aware tool or to give TimThumb more details about the WordPress directory structure.
The second solution is less desirable, because it exposes the internal directory structure to the Internet and undoes pretty URLs. TimThumb is not really the right tool to use in this situation, but given that this tool is being used, it is up to the theme or plugin writer to make the appropriate accommodations for TimThumb.
The solution described at
unfortunately no longer works because of updates to the code. The following changes combine the solution described above with the steps recommended at
https://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/
The following line numbers are from the original file. As you add lines to the file, the line numbers will increase from the original, of course, but they should be within the next 5 lines or so. Starting at line 943 is
function vslider($option='vslider_options'){ $options = get_option($option);
Add the following lines of code to check for a blog_id and create the blog path, which will be added to the image information later.
function vslider($option='vslider_options'){ global $blog_id; if (isset($blog_id) && $blog_id > 0) { $blogs_dir = '/blogs.dir/' . $blog_id; } $options = get_option($option);
Line 966 is
$thumbnailSrc = $src[0];
Add the following lines to update the thumbnail information with the correct blog information.
$thumbnailSrc = $src[0]; if (isset($blog_id) { $imageParts = explode('/files/', $thumbnailSrc); if (isset($imageParts[1])) { $thumbnailSrc = $blogs_dir . '/files/' . $imageParts[1]; } }
Line 983 is the following.
$img_url = WP_PLUGIN_URL.'/vslider/timthumb.php?src='.url encode($image).'&w='.$options['width'].'&h='.$options['height'].'&zc =1&q='.$options['quality'];
Update $img_url by adding $blogs_dir to $image.
$img_url = WP_PLUGIN_URL.'/vslider/timthumb.php?src='.urlencode($blogs_dir.$image).'&w='.$options['width'].'&h='.$options['height'].'&zc=1&q='.$options['quality'];
Line 1007 is
$img_url =WP_PLUGIN_URL.'/vslider/timthumb.php?src='.urlencode($image).'&w='.$options['width'].'&h='.$options['height'].'&zc=1&q='.$options['quality'];
Add $blogs_dir to $image, again.
$img_url =WP_PLUGIN_URL.'/vslider/timthumb.php?src='.urlencode($blogs_dir.$image).'&w='.$options['width'].'&h='.$options['height'].'&zc=1&q='.$options['quality'];
These changes may require more testing to make sure they work correctly for all sites, but the testing I have done works so far.
- The topic ‘[Plugin: vSlider Multi Image Slider for WordPress] Multisite patch for vSlider to use TimThumb’ is closed to new replies.