I'm having a hard time rendering an avatar using the HBS templating engine.
{{# each players }}
<div class="jumbotron" style="padding:20px;">
<img src="data:image/png;base64,{{this.avatar.toString('base64')}}"/>
<h3>Name: {{ this.firstName }} {{this.lastName}}</h3>
<h3>Weight: {{ this.weight }} </h3>
<h3>NoGi Rank: {{ this.nogi }} </h3>
<h3>Gi Rank: {{ this.gi }} </h3>
<p><a class="btn btn-primary btn-lg" href="/players/opponent/{{this._id}}" role="button">View Profile</a></p>
<br>
</div>
{{/each}}
It seems you can't convert binary data to a base64 string inside the double curly brackets.
Is there another way of doing this?
I tried converting the avatar from binary to string inside the GET route and thus rendering a separate 'image' attribute. This image works fine outside the players for-loop but not within.