Reputation: 105
I've been trying to get the bengott:avatar package from atmosphere.js to work with Facebook but have not been able to do so. When I use {{> avatar user=this shape="circle"}}
it only seems to display a gray circle with no picture inside.
Other calls such as {{currentUser.profile.name}}
work perfectly fine.
How can I successfully display an avatar with or without the bengott:avatar package?
Upvotes: 0
Views: 621
Reputation: 495
I use a helper function based off of the Facebook ID of the user to grab the image on the server. 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;
}
},
In the template you would use the helper like this:
<img src="{{userPicHelper}}" alt="" />
Upvotes: 1
Reputation: 453
Use this instead, you don't need an access token or anything special to get their profile picture, just their facebook user id.
Accounts.onCreateUser(function(options, user) {
if (options.profile) {
options.profile.picture = "http://graph.facebook.com/" + user.services.facebook.id + "/picture/?type=large";
user.profile = options.profile;
}
return user;
});
Upvotes: 1