For the purpose of loading images in background I use $.each to iterate the fNames array which holds the images paths. For each of the loaded images I get 0 for width and height in the load method. Code follows -
$.each(fNames, function (a, b) {
var imm = new Image();
$(imm).load(function () {
var w = $(this).width();
var h = $(this).height();
console.log(b + " --> " + w + " X " + h);
$(this).appendTo("#imgList");
})
.click(function () {
$(".dialogImage").css("border", "none");
$(this).css("border", "2px solid black");
selectedImage = b;
})
.addClass("dialogImage")
.attr({
"src": "/customers/" + $("#IDHiddenField1").val() + "/" + $("#projectIDHiddenField1").val() + "/" + b,
"title": b
});
});
How can I get width and height of the loaded images ?