Get image size
by Greggg
HTML
<div id="info"></div>
<img id="image" src="https://images.unsplash.com/photo-1543882892-98c7e865c7b8">
JavaScript
getImageSize($('#image'), function(width, height){
$('#info').text(width + ',' + height);
});
function getImageSize(img, callback) {
var $img = $(img);
var wait = setInterval(function() {
var w = $img[0].naturalWidth,
h = $img[0].naturalHeight;
if (w && h) {
clearInterval(wait);
callback.apply(this, [w, h]);
}
}, 30);
}