Search code examples
facebooklocalhostpublishmamp

Trouble linking to images on localhost in a post from a Facebook application


I use the following code to publish to a users wall in my Facebook app I have just started:

    FB.ui(
{
 method: 'feed',
 name: 'Facebook Dialogs',
 link: 'http://developers.facebook.com/docs/reference/dialogs/',
 picture: 'http://localhost:8888/project_images/110/110.png',
 caption: 'Reference Documentation',
 description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
 message: 'Facebook Dialogs are easy!'
},
function(response) {
 if (response && response.post_id) {
   alert('Post was published.');
 } else {
   alert('Post was not published.');
 }
}
);

Sadly this does not display the image eventhough when I enter: http://localhost:8888/project_images/110/110.png into my browser the image displays without an issue. Also, when I use the default from the example: http://fbrell.com/f8.jpg as the picture: parameter the image shows up fine. Is this not working because of the localhost? I am running localhost off MAMP.


Solution

  • I ran into this issue as well. I think it is because Facebook attempts to fetch the image, and cannot get to localhost.