I want to get image size and put it into an object. Here is the code I wrote which doesn't work as I intended.
var images = { a: { src: 'http://aaa/'}, b: {src: 'http://bbb/'}, … };
for (var i in images) {
var img = new Image();
img.onload = function() {
images[i].width = this.width;
images[i].height = this.height;
}
img.src = images[i].src;
}