# How to render avatar images to .hbs template with user\_id

**URL:** <https://meta.discourse.org/t/how-to-render-avatar-images-to-hbs-template-with-user-id/63571>\
**Category:** Development\
**Created:** [2017年五月29日 18:27 UTC](https://meta.discourse.org/t/how-to-render-avatar-images-to-hbs-template-with-user-id/63571 "2017-05-29T18:27:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![codechef](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codechef/32/90261_2.png) [@codechef](https://meta.discourse.org/u/codechef)\
**Post date:** [2017年五月29日 18:27 UTC](https://meta.discourse.org/t/how-to-render-avatar-images-to-hbs-template-with-user-id/63571/1 "2017-05-29T18:27:01Z")

</div>

I’m probably making this more difficult than it needs to be. I have a plug-in with a handlebars template. Within it, I have access to a list of objects that include a user\_id. From that user\_id, I’d like to render an avatar image. If needed, I could include the username, but still can’t figure out the correct way to accomplish this.

Ideally, I’d hope for something as simple as an img element with a src attribute of something like /avatar\_img//\<user\_id\>.png.

Note: I have found the {{avatar}} ember helper, but it seems to expect a full user object. Also, I’m a Discourse dev N00b so don’t rule out simple stuff.

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2017年五月29日 20:31 UTC](https://meta.discourse.org/t/how-to-render-avatar-images-to-hbs-template-with-user-id/63571/2 "2017-05-29T20:31:09Z")

</div>

You won’t be able to render an avatar with only the user\_id. You need the `avatar_template` attribute that is available on the user model.

---

<div class="post-metadata">

**Author:** ![codechef](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codechef/32/90261_2.png) [@codechef](https://meta.discourse.org/u/codechef)\
**Post date:** [2017年五月31日 17:42 UTC](https://meta.discourse.org/t/how-to-render-avatar-images-to-hbs-template-with-user-id/63571/3 "2017-05-31T17:42:14Z")

</div>

Okay, I’ll pull it too. With that attribute, what’s the correct way to then display the avatar?
