Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

When I first wrote about ingegreating with Facebook I shared an example on how to share a post link and provide additional data like a picture to use as a thumbnail. This used to tell Facebook that the provided picture should be shown as the link preview, this no longer works. You can still submit the 'picture' property as a URL but it will be ignored. This behaviour is described in the Graph API version 2.10. Fortunately there is a way to control which image Facebook will use.
fb_og_inferred2.png


First lets understand why this change has been made. Facebook had this to say about the topic.
As part of our continuing efforts to stop the spread of misinformation and false news on our platform, earlier this year at F8 we announced an important change to our Graph API: Graph API version 2.9 includes a 90 day deprecation of the ability to edit previews attached to link posts.


So it's all about fake news. Although I understand Facebook's position on this, I do not agree completely with this change. Lets look at what you can do now to control which image appears as a link preview thumbnail...



As Facebook said, the Open Graph meta tags are the currently supported way to modify link previews. Fortunately this is easy to add to a CMS or Blog system. It only took me a couple of hours to have a full end-to-end solution in my Blog's code working.

The trick is to implement tags like this in the <header> of your generated HTML page...
 OpenGraph image tags
<meta property="og:image" content="https://www.mydomain/myimage.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="300" />
<meta property="og:image:height" content="300" />


The og:image tag is the one that is required, others are optional but I would recommend using them. This works the same way as back when the 'picture' property was supported with the API. Simply put the URL of the image into the content attribute and you're done. The image here needs to meet some guidelines e.g. it has be be less than 8Mb in size for Facebook to download it.

The og:image:type tag specifies the MIME type of the image. The og:image:width and og:image:height provide the width and height of the image (in pixels) respectively.

A PHP example on posting links is covered in Facebook's documentation here. Don't forget to use the URL Debugger after making your changes to ensure Facebook is behaving as you were expecting.

-i

Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...
Hi! You can search my blog here ⤵
Or browse the recent top tags...

Recent Blog Posts

How to stop macOS adding shadows to window screenshots

How to run Atari Lynx games on the SNES Classic Mini

Maven dependency scopes with relation to WAR file packaging and the WEB-INF/lib directory

Hacking the Sonoff B1 WiFi LED bulb to run custom firmware

What does an idle WebLogic server run on the hour to cause a CPU spike

How to open the Sonoff B1 wifi LED bulb to access its internal circuitry

Australian release SNES mini classic unboxing and a quick play through

Troubleshooting high CPU usage for JVM threads

How to fix WebLogic high CPU usage due to a corrupted file store

Mini review of the Sonoff B1 WiFi light bulb

Recent Galleries

Atari Lynx repair - Part 5 - McWill LED screen mod installation

Atari Lynx repair - Part 4 - screen cover replacement

Atari Lynx repair - Part 2 - re-capping the motherboard

Atari Lynx repair - Part 3 - broken speaker replacement

Atari Lynx repair - Part 1 - introduction and case disassembly

Building a custom Atari Lynx game box storage shelf unit in a day

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity