Images not being recognized by slider script in subdirectory site
-
Hi,
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:
ttp://www.lipolitics.com/wp-content/uploads/media/And the subdirectory media library images are in:
ttp://www.lipolitics.com/huntington/files/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!
-
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?
I believe the answer is yes to both.
*sigh*
Then the best answer is ‘Don’t use TimThumb.’
Or if you MUST: http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/
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?
Ah thanks for your reply!
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?
I believe so, though I don’t use timthumb BECAUSE it doesn’t like Multisite.
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.
The real directory is http://www.lipolitics.com/huntington/wp-content/blogs.dir/#/files/…
Where # is the id for that blog.
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?
Actually, I think it would be better to switch to another slider. Do you recommend one that works well on mu sites?
The one I use is built into my theme. The rest of the time I tend not to use them.
- The topic ‘Images not being recognized by slider script in subdirectory site’ is closed to new replies.