Jul 282012
 

Recently I imported several blogs into a WordPress multisite installation (using sub-directories, not sub-domains).

I had an issue with my photo blog that uses the YAPB (yet-another-photoblog) plugin. Images were not shown and I got an “Error: File not found!” message when I tried to upload images.

Cause

The error was caused by the method YapbImage::systemFilePath() when it tried to _combinePaths(). E. g. it could not combine the following pathes:

$full_path = /var/www/vhosts/zett42.de/httpdocs/wp-content/blogs.dir/4/files
$uri = photoblog/files/2012/07/mypic.jpg

This is because for the multisite feature, one uses a rewrite rule in .htaccess to map the virtual site directories to the physical pathes.

Solution

The fix will remove the site sub folder from the $uri path, in my example “photoblog”. It has only been tested for multisite using sub-directories. Please drop a comment if it works for sub-domains too.

In ” lib\YapbImage.class.php”, function systemFilePath():

// INSERT THIS CODE
if (is_multisite()) $uri = strstr($uri, '/');
// INSERT END
// Return result
return YapbImage::_combinePaths($full_path, $uri);

WordPress version: 3.4.1
YAPB version: 1.10.9

photo blog that uses the WordPress version:/strong

  One Response to “WordPress YAPB multisite fix”

  1. thx :)

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>