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.

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.


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 remove caked on stickers from old game carts

How to pass parameters to your PHP script via the command line

jPhotoFrame new layout engine explained with examples

Atari Lynx Multi SD Card cartridge review

Jersey JAX-RS filters and interceptors execution order when throwing Exceptions

Why I'll never renew a domain with GoDaddy again

Fake AirPods - HBQ-i7 TWS wireless headset teardown

How to fix Postman error - Failed to import data: format not recognized

Switching out macOS Mail for Microsoft Outlook

Using DeoxIT to repair old game catridges

Recent Galleries

BMB-012 Nanoblock T-Rex Skeleton Model assembly

Tiny Arcade revision 6 kit assembly and decal application

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

Blogs and Friends

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

Blog Activity

Blog Activity