1

I Want to Share an image (as a normal post) on FB with some caption I've used this for sharing

<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ appId: '660612734042393', status: true, cookie: true, xfbml: true, oauth: true });

function postToWall() {  
  FB.login(function(response) {
    if (response.authResponse) {
      FB.ui({
        method: 'feed', 
        picture: 'http://searchengineland.com/figz/wp-content/seloads/2015/10/google-panda-name3-ss-1920-800x450.jpg',
        caption: 'Checkout the image ',
        description: 'Checkout the image Checkout the image Checkout the image .'
      },
      function(response) {
        if (response && response.post_id) {
          alert('Post was published.');
        } else {
          alert('Post was not published.');
        }
      });
    } else {
        //alert('User cancelled login or did not fully authorize.');
      }
    }, {scope: 'publish_actions,email'});
  return false;
}
<a href="#" onclick="return postToWall();"><img type="button" src="../img2/shareFb.png"style="width: 109px;height: 50px;" ></a>

When I share image using this it gets shared like this The image I shared using the above code

this gets shared like a link instead I want to share this image like a normal image post like we do on FB like this

The way I want to share the image

I've checked on FB sdk but didn't find the exact solution for this. any help will be appreciated thanks

Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60
VishAl
  • 388
  • 3
  • 17
  • 2
    not sure.but aren't you trying to upload a photo instead of sharing? read this https://developers.facebook.com/docs/graph-api/reference/user/photos/ and this question http://stackoverflow.com/questions/4999024/facebook-graph-api-upload-photo-using-javascript – Madhawa Priyashantha May 04 '16 at 06:06
  • ok let me give it a try. – VishAl May 04 '16 at 06:09

0 Answers0