简体   繁体   English

Facebook定制故事与大图像 - 用Javascript打开图表

[英]Facebook custom stories with big Image - Open Graph with Javascript

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. 现在我创建了一个Object,Action和一个故事,将两者结合起来。 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 我想要实现的是一个看起来像这样的故事https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851562_1376970469205025_523101852_n.png ,但我似乎只是得到了是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. 我包括的图像是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 ). 我还尝试使用'user_generated'图像标记,它以全文宽度显示图像,但是当您点击图像时它不会将您链接回网站,但它会在模态框中打开图像(如图库图像) )。

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. 如果我能提供更多信息来获取此问题的解决方案,请告诉我。

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 . 我没有尝试过630px的高度,但似乎它应该可以工作,甚至可能更好,值为630 See Facebook content sharing best practices. 查看Facebook内容共享最佳实践。

Try to use an image with 1200X650 as stated instead of 1200X630. 尝试使用1200X650的图像而不是1200X630。 as stated on documentation images must keep aspect ratio. 如文档中所述,图像必须保持纵横比。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM