[SOLVED] User avatar not displaying


#1

I want to display the avatar for the current user. I am using the “utilities:avatar” package to do this. However, all I get is a blank gray image.

I am using the default options to display the avatar:

 <p>{{> avatar user=this shape="circle"}}</p>

I created a test app to debug this. The app is posted at: https://github.com/andersr/meteor-avatar-test

I am able to sign in to the app, but no avatar or any of the fallbacks are displaying.

Any suggestions re. what the problem might be would be very much appreciated!

Packages installed

⚡   meteor list
accounts-password  1.1.1  Password support for accounts
accounts-ui        1.1.5  Simple templates to add login widgets to an app
autopublish        1.0.3  Publish the entire database to all clients
insecure           1.0.3  Allow all database writes by default
meteor-platform    1.2.2  Include a standard set of Meteor packages in your app
utilities:avatar   0.7.12  Consolidated user avatar template (twitter, facebook, gravatar, etc.)

#2

Well, it gets profile image from FB, etc
You are using accounts-password so no image


#3

According to the docs it will end up trying gravatar with the email hash, so it should work.


#4

maybe it has something to do with this in helpers.js from package github

var options = {
// NOTE: Gravatar’s default option requires a publicly accessible URL,
// so it won’t work when your app is running on localhost and you’re
// using an image with either the standard default image URL or a custom
// defaultImageUrl that is a relative path (e.g. ‘images/defaultAvatar.png’).
default: gravatarDefault,
size: 200, // use 200x200 like twitter and facebook above (might be useful later)
secure: true
};


#5

Change your html:

{{#with currentUser}}
  <p>{{> avatar user=this shape="circle"}}</p>
{{/with}}

(the user=this was in the wrong context)


#6

That fixed it. Thanks!