Facebook Custom Stories with Large Image - Open Graph with Javascript

I try to create a user story with a new image every time someone tries to publish it. Now I created Object, Action and Story, combining them. What I would like to get is a story that looks like https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851562_1376970469205025_523101852_n.png , but all that I seems to be getting this https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851560_389589627833470_1903099476_n.png

Let's say that my object is a course, and my action is performed. Below is the code that I have that does not return the correct results. The image I turn on is 1200 x 630.

FB.api( 'me/namespace:run', 'post', { course : { "og:type" : "namespace:course", "og:url" : "http://example.com", "og:title" : "Title", "og:description": "Description", "fb:app_id" : "####", "og:image" : "http://example.com/chart.png" }, distance : 25.5, location : "Sample location: Longitude", message : "Special Caption Message" } 

I also tried to use the image flag "user_generated", it displayed the image at the full width of the plot, however, when you click on the image, it does not connect you to the site, but it opens the image in a modal field (for example, a gallery image).

I'm not sure if this is code or not. Perhaps some settings I do not know. Let me know if there is any additional information I can provide in order to get a solution to this problem.

+6
source share
2 answers

You need to specify the width and height:

 "og:image:width": 1200, "og:image:height": 650 

I have not tried it with a height of 630 pixels, but it seems that it should work and may even be better with a value of 630 . See Facebook sharing guidelines.

+1
source

Try using an image with a resolution of 1200X650 as indicated instead of 1200X630. as indicated in the documentation, images should be proportioned.

0
source

Source: https://habr.com/ru/post/973068/


All Articles