Im trying to get the url of an uploaded image using a global template helper. So far i tried doing isPrimary.url() but i only get null, otherwise isPrimary.url returns a function. Any idea how to deal with this?
user_item.html
<template name="userItem">
<div class="col-md-3">
<div class="text-center">
<img width="80" class="img-rounded" src="{{primaryPicture store='thumb'}}">
</div>
</div>
</template>
global_templates.js
Template.registerHelper('primaryPicture', function () {
var isPrimary = Images.findOne({userId: this._id, primary: true});
if (isPrimary) {
return isPrimary.url();
} else {
return '/user.png';
}
});