Within my markup, I have an image field that I am setting the source for using JavaScript. I am in need of its height and width, so I utilized the image.height() and image.width() methods. Despite working properly in Internet Explorer, these methods do not seem to be functioning in Chrome. I attempted to use image.height and image.width instead, but unfortunately, no values were returned.
Moreover, I also tried changing the prop method to attr for setting the image src, which resulted in the same outcome. Below is a snippet of my code:
function new()
{
timg = new Image();
timg.src=fpath;
}
I call this code within another method:
function Size(timg) {
var con=150;
th=timg.height;
alert("th="+th); //this always returns Zero in Chrome
tw=timg.width;
alert("tw="+tw); //this also returns Zero in Chrome
}
If anyone has any advice or suggestions, please let me know!