嗨,我正在尝试从我的 FB 应用程序将图像发布到朋友墙上。我有这个代码,但不知道如何将图像附加到帖子中。它只发布文本。有人有工作的例子吗?或者我哪里有错误?谢谢。
此处图像的完整路径 - 替换为图像的路径 此处我的 FB 应用程序的完整路径 - 替换为 fb 应用程序的路径。
FB.ui(
{
target_id: '100000505490012',
method: 'stream.publish',
message: 'Just Testing!!!.',
attachment: {
name: 'test name',
caption: 'Caption here.',
description: (
'description here'
),
href: 'http://facebook.com/mysite'
},
media: {
type: 'image',
src: 'FULL PATH TO IMAGE HERE',
href:'FULL PATH TO MY FB APP HERE'
},
action_links: [
{ text: 'Code', href: 'FULL PATH TO MY FB APP HERE' }
],
user_prompt_message: 'Personal message here'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);