How do I know the actual size of the image on the page?

Source: Internet
Author: User
Two files below the page:
<!--#include virtual= "/intels/chunfeng/graphicdetect.asp"-->
<TITLE> Image Dimensions </TITLE>
<body bgcolor= "#FFFFFF" >
<%
Graphic= "Images/intels.gif"
HW = readimg (graphic)
Response.Write Graphic & "Dimensions:" & HW (0) & "x" & HW (1)
& "<br>"
Response.Write "Response.Write height= "" "& HW (0) &" ""
Response.Write width= "" "& HW (0) &" > "
%>
</body>

------------------------
Graphicdetect.asp
<%
Dim HW

Function Ascat (s, N)
Ascat = ASC (Mid (S, N, 1))
End Function

Function Hexat (s, N)
Hexat = Hex (Ascat (S, N))
End Function

Function isjpg (Fichero)
If inStr (UCase (Fichero), ". JPG ") <> 0 Then
Isjpg = True
Else
Isjpg = False
End If
End Function

Function Ispng (Fichero)
If inStr (UCase (Fichero), ". PNG ") <> 0 Then
Ispng = True
Else
Ispng = False
End If
End Function

Function Isgif (Fichero)
If inStr (UCase (Fichero), ". GIF ") <> 0 Then
Isgif = True
Else
Isgif = False
End If
End Function

Function isbmp (Fichero)
If inStr (UCase (Fichero), ". BMP ") <> 0 Then
Isbmp = True
Else
Isbmp = False
End If
End Function

Function iswmf (Fichero)
If inStr (UCase (Fichero), ". WMF ") <> 0 Then
Iswmf = True
Else
Iswmf = False
End If
End Function

Function iswebimg (f)
If isgif (f) or isjpg (f) or ispng (f) or isbmp (f) or iswmf (f)
Then
Iswebimg = True
Else
Iswebimg = True
End If
End Function

Function readimg (Fichero)
If isgif (Fichero) Then
readimg = Readgif (Fichero)
Else
If isjpg (Fichero) Then
readimg = readjpg (Fichero)
Else
If ispng (Fichero) Then
readimg = Readpng (Fichero)
Else
If isbmp (Fichero) Then
readimg = Readpng (Fichero)
Else
If iswmf (Fichero) Then
readimg = readwmf (Fichero)
Else
readimg = Array (0,0)
End If
End If
End If
End If
End If
End Function

Function readjpg (Fichero)
Dim FSO, TS, S, HW, nbytes
HW = Array ("", "")
Set fso = CreateObject ("Scripting.FileSystemObject")
Set ts = fso. OpenTextFile (Server.MapPath ("/" & Fichero), 1)
s = Right (ts. Read (167), 4)
HW (0) = Hextodec (Hexat (s,3) & Hexat (s,4))
HW (1) = Hextodec (Hexat (s,1) & Hexat (s,2))
Ts. Close
Readjpg = HW
End Function

Function Readpng (Fichero)
Dim FSO, TS, S, HW, nbytes
HW = Array ("", "")
Set fso = CreateObject ("Scripting.FileSystemObject")
Set ts = fso. OpenTextFile (Server.MapPath ("/" & Fichero), 1)
s = Right (ts. Read (24), 8)
HW (0) = Hextodec (Hexat (s,3) & Hexat (s,4))
HW (1) = Hextodec (Hexat (s,7) & Hexat (s,8))
Ts. Close
Readpng = HW
End Function

Function Readgif (Fichero)
Dim FSO, TS, S, HW, nbytes
HW = Array ("", "")
Set fso = CreateObject ("Scripting.FileSystemObject")
Set ts = fso. OpenTextFile (Server.MapPath ("/" & Fichero), 1)
s = Right (ts. Read (10), 4)
HW (0) = Hextodec (Hexat (s,2) & Hexat (s,1))
HW (1) = Hextodec (Hexat (s,4) & Hexat (s,3))
Ts. Close
Readgif = HW
End Function


Function readwmf (Fichero)
Dim FSO, TS, S, HW, nbytes
HW = Array ("", "")
Set fso = CreateObject ("Scripting.FileSystemObject")
Set ts = fso. OpenTextFile (Server.MapPath ("/" & Fichero), 1)
s = Ri



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.