get dimentions of image while uploading
<p>While browsing and uploading images, I want to know the image's height and width and based on this I want to resize and show it. Can I achieve this with javascript?</p>

<p>I am trying this the following code but its working only in IE, any other solutions please?</p>

<pre><code> img_id++;
 var id="imgid"+img_id;
 image = document.getElementById('submit').value;
 document.getElementById('div').innerHTML="&lt;img id='"+id+"' src='"+image+"' &gt;";
 document.getElementById(id).style.visibility="hidden";
 alert(document.getElementById(id).offsetWidth +'by'+document.getElementById(id).offsetHeight);
</code></pre>

<p>Thanks.</p>
