Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update facebook open graph image

Say if you have set the facebook image for your webpage via the meta tag of the open graph protocol like this: <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>

If you want to replace/update the image with another image of the same name rock.jpg, how do you get facebook to update your image accordingly with the new image when you share the page? Forcing facebook to fetch your page's data with this link http://developers.facebook.com/tools/debug won't update the image.

like image 774
eloone Avatar asked Mar 27 '13 22:03

eloone


People also ask

How do I change the image on a Facebook preview link?

Head to the 'Facebook Link Debugger'. Enter the link to your site, click the 'scrape' button a few times. Keep clicking it until your new preview image you just uploaded appears in the preview area. And presto!

How do I refresh metadata on Facebook?

You need to ping facebook and notify them to update changes and to do that you can use URL Linter. It may take some time for facebook to update your changes. I'm not sure how much time they take to update after pinging, but just try it. You can update the attributes of your page by updating your page's tags.

How do I clear the Open Graph cache on Facebook?

The Best Way to Clear Facebook's Open Graph Cache The easiest way to clear out Facebook's open graph cache is to use their debugging tool. Enter your URL of the page, hit 'debug' and then on the next page, hit 'fetch new scrape information' or 'scrape again'.


2 Answers

this is the most consistent answer I've found to this problem: https://stackoverflow.com/a/21468084/339698

If you're too lazy to go to that link, you can POST an ajax request with the url you are trying to clear:

$.post(     'https://graph.facebook.com',     {         id: 'http://www.site.com/my/share/url/',         scrape: true     },     function(response){         console.log(response);     } ); 
like image 193
hellatan Avatar answered Sep 21 '22 04:09

hellatan


Facebook stores your image into their own image on their servers, and then caches it for 24h. The cache delay might change in the future, so to check it just open the image that facebook creates from your image and check its "max-age" value in the http headers. So if you change your image, facebook will not update its version until 24h even if you use this link http://developers.facebook.com/tools/debug to force the data fetching.

To solve this, if you need to see the effect of your change right away you should rename your image. So if the old version was rock.jpg name it rock2.jpg then use this link http://developers.facebook.com/tools/debug to get facebook to create a new image from your updated image. This will update immediately your webpage's facebook image in the facebook share.

like image 32
eloone Avatar answered Sep 19 '22 04:09

eloone