Search code examples
facebookfacebook-graph-apiphotos

Posting a photo to the wall


Is it possible to post a photo to the wall (and not to the album created for the application)? I thought about iterating through all of the user's albums and posting to the one called "Wall Photos", but wonder if there is a more elegant way?

Thanks


Solution

  • You can use the FB.ui method from the Javascript SDK. If you provide the URL for the image as the link and picture parameter. This will create a wall post for the active user that has an image, a title, caption, description, etc. And the image and title will link to whatever URL you have provided.

    FB.ui({
       method: 'feed',
       name: 'Name Goes Here',
       link: 'link to the image',
       picture: 'link to the image',
       caption: 'caption goes here',
       description: 'description goes here',
       properties: ''
       }, 
       function(response) {
           //You can check the response variable to see if the post has been created
       }
    );