Last Updated: February 25, 2016
·
615
· drgorb

geting an image size in Meteor

When using Meteor it can be tricky to get at computed properties for DOM objects. This is the case with images which are not displayed until after the template has rendered.

This is important as it is not possible to check for image size in the Template.myTemplate.rendered callback

I ended up using the imagesloaded JQuery plugin which works nicely with Meteor

Just place the minified JS in the public folder of your app and include it in your HTML

<script type="text/javascript" src="/js/jquery.imagesloaded.min.js"></script>

the content of the public folder is accessible under /