Image size - not returned properly

K

Krzysztof Ciuba

Hello,
I skimmed through the news but couldn't find the solution.
I have problem with getting proper width and height values of an image.
Here is the piece of code:

<HTML>
<HEAD>
<script Language='javascript1.2' type='text/javascript'>
<!--
var imgsrc = "c:/pic1.jpg";
function iLoad(isrc) {
var oImg = new Image();
oImg.src = isrc;
if (oImg.complete) {
window.alert(oImg.src + ' ' + oImg.width + ' x ' + oImg.height);
}
else {
window.setTimeout('iLoad(imgsrc)', 1000);
}
}
//-->
</script>
</HEAD>
<body onLoad='iLoad(imgsrc)'>
</body>
</HTML>

The above works fine, but the problem occures when I replace image file on
local disk with another one (the same file name). Then the code still
returns "old" picuture's values. I assume it's because of caching.
Is there any solution that I can get proper values every time, also after
replacing files?

Thanks for your help.
Krzysztof C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,099
Messages
2,570,626
Members
47,237
Latest member
David123

Latest Threads

Top