2011-06-09 164 views
1

嗨,我想從我的FB應用程序發佈圖像給朋友牆。我有這個代碼,但不知道如何將圖像附加到帖子。它只發布文字。任何人都有工作榜樣?或者我有錯誤?謝謝。通過FB Api將圖像發佈到用戶牆上

全圖通向圖像 - 用圖像路徑取代 完整路徑到我的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.'); 
    } 
    } 
); 

回答

1

媒體屬性實際上進入附件屬性。

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.'); 
    } 
    } 
); 
相關問題