Javascript Get Image Height & Width

PHOTO EMBED

Thu Aug 18 2022 14:08:22 GMT+0000 (Coordinated Universal Time)

Saved by @mickeldav #javascript #jquery #speedoptimization

function getMeta(url, callback) {
    var img = new Image();
    img.src = url;
    img.onload = function() { callback(this.width, this.height); }
}
getMeta(
  "http://snook.ca/files/mootools_83_snookca.png",
  function(width, height) { alert(width + 'px ' + height + 'px') }
);
content_copyCOPY