Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image height and width

Status
Not open for further replies.

murugesanks

Programmer
Jan 25, 2001
48
US
Hi,
my portal had a option for uploading image. i need to resdrict the height and width of the image. for that how to get a image height and width.
-Murugesan.
 
in the client side u have to do an preview in an img tag...
Here is the code...

Code:
<HTML>

<BODY>
<input type=file name=file1 id=file1> 
<INPUT type=button value=Preview onclick=&quot;doPrewiew();&quot;>
<INPUT type=button value=ShowSize id=button1 name=button1 onclick=&quot;showSize();&quot;>
<br>
<img src=&quot;&quot; border=1 name=img1 id=img1>
</BODY>
<script language=&quot;javascript&quot;>
var d=document.all;
//or Netscape
//var d=document.layers;
function showSize()
{
	if(img1.src!=&quot;&quot;)
	{
		alert(&quot;Image HEIGHT:&quot;+img1.height);
		alert(&quot;Image WIDTH:&quot;+img1.width);
	};
};
function doPrewiew()
{
	d.img1.src=d.file1.value
};
</script>
</HTML>
________
George, M
 
Dear shaddow,
I am pleased to inform you that, the information provided by you were very usefull and working perfectly. Thanks a lot.

-Murugesan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top