Facebook javascript sdk api 分享一个链接并在墙上放一张大小为 154 的图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15386058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 00:36:43  来源:igfitidea点击:

Facebook javascript sdk api share a link and have an image of size 154 on the wall

javascriptfacebookfacebook-graph-apifacebook-javascript-sdk

提问by igrek

I need to share a link to facebook and have an image on the wall of bigger size. I share a link as follows:

我需要分享一个到 facebook 的链接,并在更大尺寸的墙上放一张图片。我分享一个链接如下:

    FB.ui(
      {
        method : 'feed',
        name: 'the name whatever',
        caption: 'some caption',
        description: 'description',
        link: 'http://mysite.com/some_page',
        picture: photo_url
      },
      function (response) { ... }
    );

The picture is bigger then 154x154, i tried size 180x180 (i read somewhere in the docs it's required 180x180), but it ends up of size 90x90 on the wall anyway :(.

图片比 154x154 大,我试过尺寸为 180x180(我在文档中的某处读到它需要 180x180),但无论如何它最终在墙上的尺寸为 90x90 :(。

If i remove the picture parameter the image will be taken of the og:image meta tag, but it is still 90x90 pixels! If i post the link myself i can see it grabs the correct size - so when i post to wall myself it posts image of size 154x154, but how can i do the same to post it via the api facebook provides?

如果我删除图片参数,图像将被 og:image 元标记拍摄,但它仍然是 90x90 像素!如果我自己发布链接,我可以看到它获取了正确的大小 - 所以当我发布到自己的墙时,它会发布大小为 154x154 的图像,但是我该如何通过 facebook 提供的 api 发布它呢?

Tried it this way as well - works the same, please help :(

也以这种方式尝试过 - 效果相同,请帮忙:(

    FB.api('/me/feed', 'post',
      {
        link : 'http://whatever_mysite.com/some_page',
        picture : photo_url
      },
      function (response) { ... }
    );

This is when posted manually, a direct link to a site(image taken off the meta tags): enter image description here

这是手动发布时,指向站点的直接链接(从元标记中删除的图像): 在此处输入图片说明

This is when shared via api(original: http://www.dandybooksellers.com/acatalog/TheoryTest.jpg): enter image description here

这是通过 api 共享时(原文:http: //www.dandybooksellers.com/acatalog/TheoryTest.jpg): 在此处输入图片说明

When no "picture" argument is provided it posts the "TEST IMAGE" from meta tags, but still with the size 90x90

当没有提供“图片”参数时,它会从元标记中发布“测试图像”,但大小仍为 90x90

回答by Amit

The URL of a picture attached to this post. The picture must be at least 50px by 50px (though minimum 200px by 200px is preferred) and have a maximum aspect ratio of 3:1

此帖子所附图片的 URL。图片必须至少为 50 像素 x 50 像素(尽管最好是最小 200 像素 x 200 像素)并且最大纵横比为 3:1

For more detail, please refer: http://developers.facebook.com/docs/reference/dialogs/feed/

详情请参考:http: //developers.facebook.com/docs/reference/dialogs/feed/