Satch3000
Satch3000

Reputation: 49414

Facebook Like not showing right image

I am using php and display rows of thumbs and records stored in mysql db.

I also have a Like button where the user clicks on it and it will come out in the user's facebook wall.

Text and links are appearing correctly but the thumbnail is always the one from the first record.

How can I make facebook show the correct thumb in the facebook wall?

Here is the code I'm using:

echo '<li>'; 
echo '<div class="thumb"><a href="inner.php?id='.$db_field['id'].'&title='.$db_field['title'].'&views='.$db_field['views'].'"><img src="images/thumbnails/'.$db_field['image'].'" alt="" /></a></div>';

echo '<div class="text_lvl_1">'.$db_field['title'].'</div>';

echo '<div class="facebook_buttons">';
echo '<fb:like href="http://www.mydomain.com/inner.php?id='.$db_field['id'].'" send="true" align="middle" layout="button_count" width="135px" show_faces="false"></fb:like>';
echo '</div>';
echo '</li>';

Upvotes: 0

Views: 195

Answers (2)

Anna Billstrom
Anna Billstrom

Reputation: 2492

Do you have a separate page for each image? On each page, show in the open graph tags, the image for that page.

If you have multiple images for one page, there's no way for the like to pick a different one each time. It's because the open graph tags are rendered before the JS (so if you use JS to manipulate, you can't.)

You can test this with the Facebook linter tool.

Upvotes: 2

C3roe
C3roe

Reputation: 96383

So your inner.php?id=123 is actually the page showing the individual images? Have you placed any code inside these pages telling facebook what the image address is, like a link element with rel="image_src" or an Open Graph meta element?

Upvotes: 1

Related Questions