The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Images not being recognized by slider script in subdirectory site (13 posts)

  1. offpeakdesign
    Posted 4 years ago #


    I have a Network setup with a subdirectory site. The site uses a jquery slider script (anything slider) and there is a field below the post editor that allows you to upload images to be included in the slider. If I put a link of an image from my main site, the image appears fine, but the subdirectory site's media library images are not appearing in the slider.

    I also notice that my main site images are in a directory called:

    And the subdirectory media library images are in:

    In case that factors into it.

    Just to summarize, the when I add images to the subdirectory site they will not appear in the subdirectory's slider. I currently have to link the images from my main/original site in order for images to show.

    Hope this is clear.
    Any help much appreciated!

  2. I'm psychic. Your slider was coded to look in wp-content/uploads and doesn't know how to use the /files/ (which are actually in wp-content/blogs.dir/#/files/)

    Is it using TimThumb?

  3. offpeakdesign
    Posted 4 years ago #

    I believe the answer is yes to both.

  4. *sigh*

    Then the best answer is 'Don't use TimThumb.'

    Or if you MUST: http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/

  5. offpeakdesign
    Posted 4 years ago #

    Just to further clarify, there is a thumb.php file within the theme files that looks to house the TimThumb script. Do you think that I need to adjust code within that file?

  6. offpeakdesign
    Posted 4 years ago #

    Ah thanks for your reply!

  7. offpeakdesign
    Posted 4 years ago #

    I would like to temporarily continue to use timthumb for now.

    Your link mentions to add code to get the correct file path for the image, but would I be adding it to the thumb.php file?

  8. I believe so, though I don't use timthumb BECAUSE it doesn't like Multisite.

  9. offpeakdesign
    Posted 4 years ago #

    oh wow, such a long thread on binarymoon! Looks like this is a major issue. So I think I understand the issue is that I need to know where the image file is actually stored since it's in a 'virtual' directory. So I'm thinking that I need to change the following code (from binarymoon's recommended code), but I'm confused about how.

    $theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];

    This seems like it should work if the file is in site.com/subdirectory/files/

    Would you know how I should change this line of code to get the right path? For example, this link shows the image...


    ...But I know that this doesn't actually exist because it's some kind virtual directory and I'm thinking that may be the problem. That I need to reference the real directory location of the file.

    By the way, thanks so much for getting me to at least sort of start to understand the issue. It's been driving me nuts.

  10. The real directory is http://www.lipolitics.com/huntington/wp-content/blogs.dir/#/files/...

    Where # is the id for that blog.

  11. offpeakdesign
    Posted 4 years ago #

    Okay, so I've added this code to functions.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;

    but that doesn't seem to work. when I look at the slider, and look at the image info for the image that isn't working, I see that the img source is:


    Any thoughts?

  12. offpeakdesign
    Posted 4 years ago #

    Actually, I think it would be better to switch to another slider. Do you recommend one that works well on mu sites?

  13. The one I use is built into my theme. The rest of the time I tend not to use them.

Topic Closed

This topic has been closed to new replies.

About this Topic