thatgibbyguy
thatgibbyguy

Reputation: 4113

Meteor Facebook Profile Picture not Displaying

On first sign I have the following code:

Accounts.onCreateUser(function(options,user){
  if (typeof(user.services.facebook) != "undefined") {
      user.services.facebook.picture = "http://graph.facebook.com/" + user.services.facebook.id + "/picture/?type=large";
  }
  return user;
});

Which results in the following URL string

http://graph.facebook.com/[myfacebookid]/picture/?type=large

Yet when it renders that url and returns

<img scr="http://graph.facebook.com/[myfacebookid]/picture/?type=large" alt="My Name">

All I see is a broken image. How can I pull this in so that it renders the facebook profile picture?

Upvotes: 0

Views: 293

Answers (2)

Pedro Martins
Pedro Martins

Reputation: 238

You have http instead of https. So:
"https://graph.facebook.com/" + id + "/picture/?type=large";

This was my problem.

Upvotes: 0

arnonate
arnonate

Reputation: 495

I use a helper function based off of the Facebook ID of the user to grab the image on the server. I notice my url has /picture? and your has /picture/? Hope this helps.

userPicHelper: function() {
    if (this.profile) {
        var id = this.profile.facebookId;
        var img = 'http://graph.facebook.com/' + id + '/picture?type=square&height=160&width=160';
        return img;
    }
},

I don't know how I missed this before, but is this the src attribute on the image tag is actually written as scr:

<img scr=

Should be...

<img src=

Upvotes: 1

Related Questions