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

How to get Get The Image plugin to work on my site? WordPress


The site:

I'm using WordPress MU Sitewide Tags Pages to pull posts in from the satellite blogs made by Multisite, but it isn't bringing the blog thumbnails with the posts as you can see in the "Mythos Journals" category on my site.

My forum post about this:

So it appears Get The Image plugin will solve this but it's a bit steep in code work for me. Can you tell me exactly what code to put in which file? If so, that would be perfect.

EDIT: Here is the index.php code...

<?php get_header() ?>

<div id="container">
<div id="content">

<form action="" method="post" id="groups-directory-form" class="dir-form">
<h3><?php _e( 'Groups Directory', 'buddypress' ) ?><?php if ( is_user_logged_in() ) : ?> &nbsp;<a class="button" href="<?php echo bp_get_root_domain() . '/' . BP_GROUPS_SLUG . '/create/' ?>"><?php _e( 'Create a Group', 'buddypress' ) ?></a><?php endif; ?></h3>

<?php do_action( 'bp_before_directory_groups_content' ) ?>

<div id="group-dir-search" class="dir-search">
<?php bp_directory_groups_search_form() ?>
</div><!-- #group-dir-search -->

<div class="item-list-tabs">
<li class="selected" id="groups-all"><a href="<?php bp_root_domain() ?>"><?php printf( __( 'All Groups (%s)', 'buddypress' ), bp_get_total_group_count() ) ?></a></li>

<?php if ( is_user_logged_in() && bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
<li id="groups-personal"><a href="<?php echo bp_loggedin_user_domain() . BP_GROUPS_SLUG . '/my-groups/' ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
<?php endif; ?>

<?php do_action( 'bp_groups_directory_group_types' ) ?>

<li id="groups-order-select" class="last filter">

<?php _e( 'Order By:', 'buddypress' ) ?>
<option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
<option value="popular"><?php _e( 'Most Members', 'buddypress' ) ?></option>
<option value="newest"><?php _e( 'Newly Created', 'buddypress' ) ?></option>
<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ) ?></option>

<?php do_action( 'bp_groups_directory_order_options' ) ?>
</div><!-- .item-list-tabs -->

<div id="groups-dir-list" class="groups dir-list">
<?php locate_template( array( 'groups/groups-loop.php' ), true ) ?>
</div><!-- #groups-dir-list -->

<?php do_action( 'bp_directory_groups_content' ) ?>

<?php wp_nonce_field( 'directory_groups', '_wpnonce-groups-filter' ) ?>

</form><!-- #groups-directory-form -->

<?php do_action( 'bp_after_directory_groups_content' ) ?>

</div><!-- #content -->
</div><!-- #container -->

<?php locate_template( array( 'sidebar.php' ), true ) ?>

<?php get_footer() ?>

Answers (3)


Duncan O'Neill answers:

Hi Sidian,

it may seem like an obvious question, but have you checked whether the 'failing' images you're trying to reference actually exist on the server?

Because if they do, then it's just a matter of tweaking the code which calls them.

For example, on your front page,one of the failing images is sourced like this;

But the images which don't fail are sourced differently, like;

Even when I use Firebug to change the source for the top example to;

the image doesn't show...

and when I type this into a browser location bar;

I get an http response of 500 Internal Server error.

So it looks as if the images /are/ there, but either;

1) They're not being referenced the right way, OR
2) There's something in your .htaccess file which is messing things up

Hope this helps, please let me know if you want to further follow this route.

This code included from the themes functions.php did the trick;

//global $blog_id;

// get the blog id from the posts custom field blogid added by multisite plugin
$blog_id = get_post_meta($post->ID,"blogid",true);

// if that doesn't work, get the blogid from the permalink
if (!$blog_id){
global $domain;
$url_path = split("/",parse_url(get_post_meta( $post->ID, "permalink", true ),PHP_URL_PATH));
$path = "/".$url_path[1]."/";
$blog_id = get_blog_id_from_url( $domain, $path);

// if that still doesn';t work, use the current ( master ) blog - existing code

Sidian Jones comments:

Thanks for the detective work Duncan.
Here is the htaccess code, hope this helps.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# END WordPress

Sidian Jones comments:

Also this image url for the rose works:

I grabbed it from the actual blog entry.

Duncan O'Neill comments:

I'm no expert at rewriterules, unfortunately, but it looks from the above as if it's rewriting urls containing "files". The images which /dont/ use that reference are working, those that do, aren't.

Playing around now trying to find another way to reference the 'broken' images.

For example, the purple rose image is being called in using the sub-sites number (1) rather than name ( theevolutionoftheinnerme ). Is there a way from the backend that you can tell it to call the images using the sub-site's name?

More soon...

Duncan O'Neill comments:

Or, just plugging that image url you gave me;

into the src attribute of the html using firebug works on this page;

The dimensions are already taken care of by the width and height attributes of the <img> tag, so that's it's resized down from its original 300x225 to 220x150.

Is it possible to just alter the src attribute when you're calling the image?

Sidian Jones comments:

Hm...the only way I could think to do what you are asking is to alter some field in some options menu....somewhere.
I guess I'll have to take a look.

Sidian Jones comments:

Hm...the only way I could think to do what you are asking is to alter some field in some options menu....somewhere.
I guess I'll have to take a look.

Sidian Jones comments:

Ok so check it out, I guess my theme is using TimThumb and it's screwing things up maybe:

Duncan O'Neill comments:

Hi again,

yep, it seems it is TimThumb messing things up...

I guess you can't just turn off the plugin, if it's part of your theme.

And from the code under the heading "Pulling this all together" from your link above, it seems that the changes to make to make it work with WP MU are already in place.

But rather than add another plugin ( Get The Image ) to try to correct the mess-up, can I suggest;

1) Commenting out this line from your .htaccess;

RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

2) If that doesn't work, then consider making changes to your functions.php file to disable timthumb.

3) If necessary, making changes to your css to force the relevant images to display at the correct size.

Hope this helps..



Sidian Jones comments:

1. Broke the site. Not sure why?

2. I wouldn't know what to do here.

3. Wouldn't know what to do here either. :(

I'm really makin ya work for this $10, sorry about that. I'll bump up the prize if you want to continue helping me with 2 and 3. Do you want or need FTP access?

Duncan O'Neill comments:

Hi again Sidian,

yes, FTP access would help. Please message me on here, and we can sort it from there.




Kailey Lampert answers:

Any chance I/we can take a look at the code that's currently being used for the front page?

I might be able to figure out what should go where if I can see how things are setup currently.

Sidian Jones comments:

Guess that would be the index.php then? Hope so. I posted it above now.


Nilesh shiragave answers:

Show your front page code? so we can figure out what exactly the problem is