Click to See Complete Forum and Search --> : How to get an original size of an image before placing it on a page?


AndyWawa
09-22-2003, 10:15 AM
Hi,
how can I get an original size of an image before placing it on a HTML-Site? I'm creating dynamically a page with lots buttons representing VB-Forms (a kind of Online-Help). OnClick-Event I'm using a javascript function showing an image. It works, but the images have a diffrent size and the images are not properly scaled. What is to do?
Thanks Andy

pyro
09-22-2003, 10:18 AM
You can do that like this:

<script type="text/javascript">
img = new Image();
img.src = "images/yourimage.gif";
alert ("Width: "+img.width+"\nHeight:"+img.height);
</script>