嗨,我正在尝试从我的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.');
}
}
);
发布于 2011-06-15 01:39:07
媒体属性实际上位于附件属性内部。
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.');
}
}
);
https://stackoverflow.com/questions/6290528
复制相似问题