Avatars not showing on plugin

Hi, I am trying to get avatars to show up on my plugin, but when I pull the avatar_template its shows up like this…

src="/user_avatar/sitename/natasha/{size}/630932_2.png"

I think it has something to do with size variable :thinking:

1 Like

If you replace the {size} portion of the string with a number it should generate the avatar.

You could perhaps create a computed property, that takes the avatar_template and replaces it with a number like:

  @discourseComputed("user.avatar_template")
  avatarSrc(avatarTemplate) {
    return avatarTemplate.replace("{size}", "75");
  },

and then call that in your template:

<img src={{avatarSrc}} alt="the profile photo of the user"/>
3 Likes

Awesome! That totally worked. Thank you so much! :raised_hands:t3:

1 Like