JSFiddle - React, Tailwind, and code Playground
JavaScript
function getMeta(url, callback) {
var img = new Image();
img.src = url;
img.onload = function() {
callback(this.width, this.height);
}
}
// "http://snook.ca/files/mootools_83_snookca.png" //1024x678
// "http://shijitht.files.wordpress.com/2010/08/github.png" //128x128
function alertDimensions(width, height) {
alert(width + ' width ' + height + ' height');
}
getMeta("http://snook.ca/files/mootools_83_snookca.png", alertDimensions);