我正在尝试在我的用户点击按钮后将图片发布到他们的 Facebook 墙上
我正在使用 javascript SDK 但我有一个问题,图像看起来像墙上的链接...但这不是我想要的...我想发布图像...与您放置时相同状态文本字段上的图片链接,它会变成图片
有什么帮助吗?
FB.ui(
{
method: 'stream.publish',
message: 'test',
attachment :{
'name': 'i\'m bursting with joy',
'href': ' http://bit.ly/187gO1',
'caption': '{*actor*} rated the lolcat 5 stars',
'description': 'a funny looking cat',
'properties': {
'category': { 'text': 'humor', 'href': 'http://bit.ly/KYbaN'},
'ratings': '5 stars'
},
'media': [{
'type': 'image',
'src': 'http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg',
'href': 'http://bit.ly/187gO1'}]
},
user_message_prompt: 'Share your thoughts about Connect'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
最佳答案
尝试 FB.api()
方法:
var wallPost = {
message : "testing...",
picture: "http://url/to/pic.jpg"
};
FB.api('/me/feed', 'post', wallPost , function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response);
}
});
您可以获得支持的墙贴参数列表 here (参见“发布”)。
关于javascript - FACEBOOK JS SDK::如何在墙上张贴图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3361507/