Facebook sharing won’t load image from collectionFS store in mongo

Hi Guys, i am struggling with sharing image stored from cfs collection to Facebook using Facebook Connect Pluggin. I really need help on how to share the image url Facebook Connect image url tag.

Please Help!

Template.teacher.events({
   'click .student_picture_share': function(event){
        var student_image_id = this._id;
        var this_picture = Images.findOne({_id:student_image_id});
            facebookConnectPlugin.showDialog({
                method: "share",
                picture: this_picture,
                name:'Test Post',
                message:'First photo post',
                caption: 'Testing using phonegap plugin',
                description: 'Posting photo using phonegap facebook plugin'
              }, function (response) {
                console.log(response)
              }, function (response) {
                console.log(response)
              }
          );            
      }     
  });	


Thank You So Much.

Laurent Kouassi,

The issue is that you are passing the entire doucment from mongoDB into picture, when (I assume) it’s expecting a url.
Instead, get the url like so:

facebookConnectPlugin.showDialog({
    method: "share",
    picture: this_picture.url(),
1 Like

Thank you so much @coagmano for your Help.

Now when I use your suggestion and trying to share a cfs image, it only load the local IP address instead of the picture :confused:

Please Help

Is this in development or production?
have you set the ROOT_URL correctly?

1 Like

It is in Development. Should I use s
Spiraderal to remove ‘/cfs/’?
@coagmano
:thinking:

Are you using some sort of tunnel or port forwarding to allow external networks to access the app?

If it’s in development on your local machine, facebook can’t contact your app to discover the correct image, let alone load it

1 Like

Thank you so much @coagmano.
I will try it on production