0
function publish(){
  var wallPost = {
    message : "testing...",
    picture: "http://seho.woto.net/fb/cordova_bot.png"
  };
  FB.api('/me/feed', 'post', wallPost , function(response) {
    if (!response || response.error) {
      alert('Error occured');
    } else {
      alert('Post ID: ' + response);
    }
  });
}

当我使用上述功能发布到墙上时,帖子显示如下:

在此处输入图像描述

但我想要的是这样的:

在此处输入图像描述

所以我想知道如何在消息中添加图像?其他应用程序如何做到这一点?

4

1 回答 1

0

You do not want to make a post, but upload a photo to the user’s wall instead: https://developers.facebook.com/docs/reference/api/user/#photos

If you don’t want to do an actual HTTP upload of the photo data (hard to do from JS), but just have Facebook pull the photo from an URL – then use parameter url instead of source.

于 2012-11-20T10:32:05.490 回答