2

We use the Facebook Share option on a website with newsarticles. The website is build with PHP and uses Smarty. We generate a unique URL (stripped like /news/headline-of-the-article) and have the meta properties defined.

When the owner shares a links with an image that was previously uploaded, everything is fine. When he uploads a news image, inserts it into the article and shares, Facebook takes another pictures, the pictures that it finds first on the source-code. Altho, in the preview-box just before you publish, it shows the correct image. Once placed, it's the wrong one.

The Facebook Debug Tool shows as og:image tag > og:image domain/UserFiles/images/news/standard_14.jpg But when I look at the RAW tags og:image shows > domain/UserFiles/images/news/bosuil_1.jpg

So the og:image tag does it job and generates the correct URL, but facebook still posts the wrong image. When I force Facebook (manually) to scrape again, it shows everything good and also shares it correct.

I don't get it...

Grady
  • 174
  • 6
  • 21
diegie
  • 31
  • 3
  • probably a caching issue. if you are only uploading images in the development stage and they will not change once live, don't worry about it. – inarilo Aug 08 '17 at 14:22
  • The website is already live for a year and everything worked fine since a few days. I already mailed the hosting to see if they changed something regarding the caching because I know they cache a lot on that website. But maybe somebody knows another solution if the hosting won't cooperate... :) – diegie Aug 08 '17 at 14:37
  • bit old but should work... or you should be able to look up any changes https://stackoverflow.com/questions/12100574/is-there-an-api-to-force-facebook-to-scrape-a-page-again – inarilo Aug 08 '17 at 14:42

1 Answers1

2

I had the same problem and found these best practices on facebook's developer wiki: https://developers.facebook.com/docs/sharing/best-practices#precaching

Use og:image:width and og:image:height Open Graph tags

Using these tags will specify the image dimensions to the crawler so that it can render the image immediately without having to asynchronously download and process it.

After specifying the width and height we have not had a problem with facebook crawling the right picture immediately.

Community
  • 1
  • 1
Martin Lindgren
  • 374
  • 2
  • 14