Casey Flynn
Casey Flynn

Reputation: 14038

How to clear Facebook's image cache

I have a Facebook application that's created several wall-posts on behalf of my users. The image in the wall posts is cached by Facebook's servers. I've replaced the original image on my server and I would like to clear Facebook's image cache so all of the other wall posts update with the new image.

What Facebook has cached: http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=236915563048749&v=1&size=z&cksum=aebffc27f986977797a9903c2b6e08df&src=http%3A%2F%2Fvcweb2.s3.amazonaws.com%2Fassets%2Fweb%2Fimages%2Ficon_square.png

Original cached URL, now updated with new image. http://vcweb2.s3.amazonaws.com/assets/web/images/icon_square.png

Is this possible? Thanks!

Upvotes: 28

Views: 70222

Answers (5)

totymedli
totymedli

Reputation: 31068

Workaround without online debugger

You can force a refetch with the old ?v=randomhash cache invalidating trick. The only thing you have to be aware is that the URL param has to be added to every og: property.

If you have this URL: example.com/items/3, you need to do the followings:

  • Share it as example.com/items/3?v=g45f6d
  • Link the share image as <meta property="og:image" content="example.com/items/3/image?v=g45f6d" />
  • Update the URL: <meta property="og:url" content="example.com/items/3?v=g45f6d" />

Note: in this example g45f6d is a random generated hash.

This way it will appear to be an entire different page to facebook so it will crawl it just like one it sees for the first time.

Upvotes: 2

Giorgio25b
Giorgio25b

Reputation: 416

Facebook offers an online tool called Sharing Debugger that allows you to scrape the link with the latest settings.

Just paste in your link(s) in the Debug field and click debug. The magic is done!

https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fwww.iuoe115.ca%2Fprime-minister-trudeau-addresses-iuoe-canadian-conference%2F1

Upvotes: 0

confuzion
confuzion

Reputation: 29

Example:

http://www.example.com/pic001.jpg?fbrefresh=1201226471

That's the code you have to use. The 1201226471 is what you replace with your Facebook URL. You have to do it on every single page, which is quite tedious.

Upvotes: 0

Rick Kraft
Rick Kraft

Reputation: 85

In my experience, facebook doesn't dynamically update older saved images, although the data for a fan page for example, will show the current stats. I do a lot of promotion and seen older versions of messages and posts sent out, while newer page images exist. The fan page information is the same for the one now and six months ago, however.

Upvotes: 1

Nitzan Tomer
Nitzan Tomer

Reputation: 164139

The way to "force" facebook to clear their cache for a specific url is to use the Debugger tool.

I tried using the debugger with the url of the image and it shows the new image and not the old one, though when trying the cached link you posted the old image still appears.

I suspect that if you try to post new posts the new icon will be used and not the old cached version, but that link you posted probably won't be changed.

Upvotes: 51

Related Questions