I'm trying to determine the width of an image stored in GridFS on meteor so that I can re-size a modal dialog.
I have a helper for the template
Template.projectImageModalInner.image = function() {
var imageId = Session.get("selectedImageId");
//console.log("projectImageModalInner imageId: " +imageId);
var image = imageFS.findOne({_id: imageId});
url = image.fileHandler.default1.url;
console.log(url);
console.log(Imagemagick.identify(url));
return imageFS.findOne({_id: imageId});
}
which returns the correct image to the dialog to display, but I'm really having problems getting the size. The call to Imagemagick.identify blows up with an error saying "cannot call method identify on undefined" yet the line above prints the correct url.
The console log for the image url shows
/cfs/images/i5mSRED6mYgo2vK84_default1.jpg
which is the correct URL of the image being displayed in the template.
I want to set a session variable eventually with the image width so that the dialog can be dynamically sized.
I have tried getting this size from the html (with no joy), from other helpers but so far nothing is working.
Can anyone either point out what I'm doing wrong here, OR, suggest another way?