Search code examples
facebookdialogsendmessagefacebook-ui

Custom image in facebook send dialog?


I am trying to send a facebook private message via facebook send dialog in my facebook app, i have a problem while setting the custom image each time user clicks on it, i am sending the parameters as

<a href="#" onclick="send_message('<?=$transaction->user_id?>', '<?=$transaction->image_name?>')">send msg</a>

and on the function side,

FB.init({
    appId: '<?=$this->facebook->getAppID()?>', 
    xfbml: true, 
    cookie: true
});
function send_message(user_id, image_name) {
    FB.ui({
        to: user_id,
        method: 'send',
        name: 'The Image',
        description: 'Description here',
        link: 'https://www.something.com/',
        picture: '<?=baseurl()?>imagepath/'+image_name
    });
}

It works fine without picture parameter, but all the time it uses default image that facebook automatically pick from my link.

please your kind help will greatly be appreciated!


Solution

  • Using HTTPS protocol in picture link (if you do so), you might cause your problems. Take a look at Images not working in FB.ui