Facebook custom stories with big Image - Open Graph with Javascript

喜夏-厌秋 提交于 2019-12-06 01:57:26

问题


I am trying to create a custom story that has a new image every time someone tries to post it. Now I have created an Object, and Action and a Story combining the two. What I would like to achieve is a story that looks like this https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851562_1376970469205025_523101852_n.png , yet all i seem to be getting is https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851560_389589627833470_1903099476_n.png

Lets say my Object is course and my action is run. Below is the code I have the does not return the correct results. The image I am including 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 using the 'user_generated' image flag, it displayed the image at full story width however when you click on the image it does not link you back to the website but it opens up the image in the modal box ( like a gallery image ).

I am not sure if it's the code or not. Maybe some settings I am unaware of. Let me know if there is any more information I can provide to get a solution for this issue.


回答1:


You need to specify a width and a height:

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

I haven't tried it with a 630px height, but it appears that it should work and may even be better with a value of 630. See Facebook content sharing best practices.




回答2:


Try to use an image with 1200X650 as stated instead of 1200X630. as stated on documentation images must keep aspect ratio.



来源:https://stackoverflow.com/questions/25025759/facebook-custom-stories-with-big-image-open-graph-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!