I want to use the height of the image outside the onload function. I tried this, but it's not working
var nr;
function getHeightOfImage(src, cb) {
var img = document.createElement('img');
img.onload = function () {
cb(this.height);
};
img.src = src;
}
getHeightOfImage(vid.Image, function (height) {
console.log("height", height); //height available
nr = height; // nr setted here
});
console.log("nr", nr); //nr - is not setted here