96

When someone posts a link on facebook, a script usually scans that link for any images, and displays a quick thumbnail next to the post. For certain URLs though (including mine), FB doesn't seem to pick up anything, despite their being a number of images on that page.

I read up that FB prefers the "image_src" rel tag for the image the user wishes to specify, but this does not generate that thumbnail either for my site.

My url goes directly to the DNS, and is not forwarded, so I don't imagine that could be the problem either.

Does anyone have an idea as to why FB can't generate any thumbnails from my site?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
  • It would help if you gave us a link to your site (or another that doesn't work) - it might provoke some ideas. – Nick Fortescue Jul 03 '09 at 14:51
  • Here you can see how it works! I build it using PHP + jQuery. The source code is available to download. Hope you enjoy! http://lab.leocardz.com/facebook-link-preview-php--jquery/ – Leonardo Cardoso Mar 08 '12 at 00:39
  • and if you want to do the same on google plus, here's the best referenced link I could find: http://stackoverflow.com/questions/7985398/is-there-a-google-plus-1-debugger-like-the-one-in-facebook – cregox Jul 10 '13 at 23:07
  • possible duplicate of [How does Facebook Sharer select Images?](http://stackoverflow.com/questions/1138460/how-does-facebook-sharer-select-images) – dcorking Jan 28 '15 at 18:24

12 Answers12

119

The easiest way is just a link tag:

<link rel="image_src" href="http://stackoverflow.com/images/logo.gif" />

But there are some other things you can add to your site to make it more Social media friendly:

Open Graph Tags

Open Graph tags are tags that you add to the <head> of your website to describe the entity your page represents, whether it is a band, restaurant, blog, or something else.

An Open Graph tag looks like this:

<meta property="og:tag name" content="tag value"/> 

If you use Open Graph tags, the following six are required:

  • og:title - The title of the entity.
  • og:type - The type of entity. You must select a type from the list of Open Graph types.
  • og:image - The URL to an image that represents the entity. Images must be at least 50 pixels by 50 pixels. Square images work best, but you are allowed to use images up to three times as wide as they are tall.
  • og:url - The canonical, permanent URL of the page representing the entity. When you use Open Graph tags, the Like button posts a link to the og:url instead of the URL in the Like button code.
  • og:site_name - A human-readable name for your site, e.g., "IMDb".
  • fb:admins or fb:app_id - A comma-separated list of either the Facebook IDs of page administrators or a Facebook Platform application ID. At a minimum, include only your own Facebook ID.

More information on Open Graph tags and details on Administering your page can be found on the Open Graph protocol documentation.

http://developers.facebook.com/docs/reference/plugins/like

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
WyrdNEXUS
  • 1,191
  • 1
  • 7
  • 2
  • 5
    I receieved this error from the lint tool. `All the images referenced by og:image must be at least 200px in both dimensions. Please check all the images with tag og:image in the given url and ensure that it meets the minimum specification.`. Just an fyi – Trevor Apr 23 '12 at 20:48
  • i have added og tags in my code and when i tested it with og object debugger tool of facebook, it shows me correct information as I saved in og tags, but when I try to link up the page on my fb account, it shows the cached copy only. How much time fb keeps the cached copy? Is there any other way to flush the cached copy? – KAsh Apr 24 '14 at 06:59
  • Just to let you know, the only way to add an image to a post when using AppLinks (http://www.applinks.org) within the facebook app is to use the tag, using a tag with og:image will NOT work. – emerino Aug 16 '14 at 02:46
  • [This](https://developers.facebook.com/docs/reference/opengraph) has a list of types etc, and has some other useful info. – Wilf Aug 28 '14 at 11:20
61

I know this question is old, but I recently dealt with the exact same problem and went round and round on it for a couple weeks. Multiple searches on Google turned up a lot of useful information, but most of it was focused on Open Graph tags, which I wasn't interested in using. Turns out my site had multiple issues, but here are some of the basics.

  1. As EightyEight said, make sure your HTML is valid - and the same goes for your javascript and server-side code (PHP, ASP, etc.). I had a small PHP error in a piece of code that was executing as a separate call to the server from the main page. Due to a number of bizarre coincidences, that code was generating a 500 error - but ONLY for IE6 and strict parsing engines like the W3C validator and the Facebook page crawler. The problem didn't appear in modern browsers (Chrome 4, FF 3.5, IE 8, etc) so I didn't see it right away, but older/stricter clients were showing the 500 every time and that was the main reason FB wasn't crawling our page (when everything else seemed to be correct).

  2. Regarding Randy's response, he's correct that Facebook will keep an old cached copy of your page long after you've updated it. FB claims it's only held for 24 hours, but I experienced much longer times than that. FORTUNATELY, FB has released their "URL Linter" tool that will show you a preview of how your page will appear when being shared on FB, and it will force FB to instantly update its cache of your page. This was a lifesaving tool. You can find it at http://developers.facebook.com/tools/lint/

  3. Regarding the URL Linter tool, be aware that each variation of a URL is cached separately on Facebook, so "www.example.com" is not the same as "example.com". Also, unique capitalization is stored as well, so "ExampleOne.com" is not the same as "exampleone.com". (This led to a lot of confusion between my client and myself when it appeared to me that the cache had been updated just fine and the client claimed they weren't seeing the updates. Turns out I was looking at exampleone.com and had used Linter to update the cache, but they were looking at exampleOne.com which I hadn't submitted to Linter. As a result, I ended up submitting quite a few variations of the URL to Linter just to cover the bases.)

  4. WyrdNEXUS's advice to use the image_src link tag is spot-on. This allows you to be sure that FB is scraping the best possible image for your page. There are some varying guidelines out there about what specs the image file should have, but I've successfully used a 128px square image and have seen a 130x97 image make it through as well. Here is Facebook's official documentation from http://developers.facebook.com/docs/reference/plugins/like/:

    Images must be at least 50 pixels by 50 pixels. Square images work best, but you are allowed to use images up to three times as wide as they are tall.

    Obviously, FB will resize a large image for you, but you'll almost always get better results if you resize it yourself beforehand.

  5. Regarding Mike Cooper's link to the eHow article, avoid using step #1 in that article. It was valid advice when the article was written and when Mike posted the link, but it's now better to use the URL Linter tool for previewing how your page will appear when being shared. By using Linter, you won't cause FB to cache a (potentially) bad copy of the page before you get a chance to tweak it.

OneRuler
  • 711
  • 5
  • 3
  • I was struggling for days and not having my thumbnail correctly updated. The Facebook Linter tool immediatley resolved my issue - it got facebook to update its cache! Hooray! – Hady Mar 04 '12 at 00:11
  • Thanks SO much for that linter tool. Some posts on my blog were showing images, others not despite being a database-driven site. Putting the URL of the offending page into the URL Linter forced it to cache the image! Woo-HOO! – kristina childs Mar 18 '13 at 21:49
  • 4
    *lint* tool changed its name. [now it's just **debug**](http://developers.facebook.com/tools/debug): http://developers.facebook.com/tools/debug - from all I can tell, this is the **tl;dr** version of all this: **just use the tool!** – cregox Jul 10 '13 at 20:56
11

To change Title, Description and Image, we need to add some meta tags under head tag.

STEP 1 : Add meta tags under head tag

<html>
<head>
<meta property="og:url" content="http://www.test.com/" />
<meta property="og:image" content="http://www.test.com/img/fb-logo.png" />
<meta property="og:title" content="Prepaid Phone Cards, low rates for International calls with Lucky Prepay" />
<meta property="og:description" content="Cheap prepaid Phone Cards. Low rates for international calls anywhere in the world." />

NEXT STEP : Click on below link https://developers.facebook.com/tools/debug

Add your URL in text box (e.g http://www.test.com/) where you mentioned the tags. Click on DEBUG button.

Its done.

You can verify here https://www.facebook.com/sharer/sharer.php?u=http://www.test.com/

In above url, u = your website link

ENJOY !!!!

Gaurav123
  • 5,059
  • 6
  • 51
  • 81
  • Please don't post the exact same answer to multiple questions: it's either not a good fit for all or the questions are duplicates which should be flagged/closed as such. – kleopatra Feb 20 '14 at 11:58
  • Hello Kleopatra, I was thinking to post the answer to help others. I think your point is totally valid. I will take care of this. Thanks Friend – Gaurav123 Feb 20 '14 at 12:13
  • @Gaurav123 the test link is dead. However, I did check it by messaging myself on Facebook. Thank you very much for the very helpful answer! – gsamaras Aug 12 '17 at 09:34
11

Use the facebook lintter available here. http://developers.facebook.com/tools/lint/

This will check your link and re fetch any images. this also clears any old cache.

Or try this - https://developers.facebook.com/tools/debug

Community
  • 1
  • 1
mohamed azher
  • 111
  • 1
  • 2
2

Is the site's HTML valid? Run it through w3c validation service.

EightyEight
  • 3,430
  • 4
  • 36
  • 67
2

Actually, if you've already tried linking that page on Facebook BEFORE adding the "image_src" link, Facebook will keep using the old cached copy and not even see your changes. Try modifying the URL by removing or adding the 'www', or duplicate your page to test it.

Randy
  • 21
  • 1
1

I've noticed that Facebook does not take thumbnails from websites if they start with https, is that maybe your case?

Jón Trausti Arason
  • 4,548
  • 1
  • 39
  • 46
1

had the same problem and figured out that my head closing tag was in the wrong place

Diego
  • 11
  • 1
0

Old question but recently I seemed to be running into same issue with thumbnail images from my link not showing in status updates on Facebook. I post for many clients and this is relatively new.

FB doesn't seem to like long URLs anymore — if you use a URL shortener such as goo.gl or bitly.com, the thumbnail from your link/post will appear in your FB update.

0

Try using something like this:

<link rel="image_src" href="http://yoursite.com/graphics/yourimage.jpg" /link>`

Seems to work just fine on Firefox as long as you use a full path to your image.

Trouble is it get vertically offset downward for some reason. Image is 200 x 200 as recommended somewhere I read.

Nunser
  • 4,512
  • 8
  • 25
  • 37
-1

If you used any plugin for seo then Check 1st your seo plugin settings.Then find out Noindex setting if Enable Media for Noindex then disable it.