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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the width of an image

Status
Not open for further replies.

zeevlido

IS-IT--Management
Aug 14, 2000
2
IL
Hi,<br><br>I need to determin (to get) the width of an image that was uploaded to my Site. according to this parameter I want to calculate dimensions for thumbnail. How do I get it in VBscript???<br><br>Thanks, Zeevlido
 
Try this. Examples are in both javascript and vbscript. Replace the src=&quot;imagename&quot; with whatever the image is.

Code:
<html>
<head>
</head>
<body>
 <img src=&quot;imagename&quot; name=image id=image>
</body>

<script language=&quot;javascript&quot;>
 var intWidth = document.image.width;
 var intHeight = document.image.height;
 alert(&quot;Javascript=&quot; + intWidth + &quot;,&quot; + intHeight);
</script>
<script language=&quot;vbscript&quot;>
 Dim intWidth, intHeight
 intWidth = document.image.width
 intHeight = document.image.height
 alert(&quot;VBScript=&quot; & intWidth & &quot;,&quot; & intHeight)
</script>
</html>

Hope it helps,
Rob [sig][/sig]
 
Hi Rob,
Thanks for your reply.
We now need to determin the image resolution. It does not exist in this object.

Thanks, Zeevlido [sig][/sig]
 
Oooo, thats a tough one. Two ways it could be done...

Use WSH to determine the resolution. I don't know how to do it but it might be able to be done. Maybe WSH can read in the binary file and get some header info that would determine the rez. Sounds like some real programming would be involved.

There is probably an ActiveX control or ASP component out there that will do this and would be *a lot* easier than the choice above.

Good luck,
Rob [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top