I have problem with width and height.
My function:
function testImageSize(testSrc) {
var imageTestLink = "";
var link = testSrc.attr("src");
link = link.replace("/thumbs/", "/images/");
imageTestLink = link.replace(".thumb", "");
var theImage = new Image();
theImage.src = imageTestLink;
console.log(imageTestLink);
var rw = theImage.width;
var rh = theImage.height;
console.log(rw, rh);
}
My problem is that, when I run this function imagesTestLink
returns always correct link to image. But rw
and rh
sometimes return 0 0
values in console. Can someone help me solve this problem? I have read alot of topics but i dont find my answer.
Regards, Fantazy