An example of using ASP to get the actual size of an image

Source: Internet
Author: User
Example <!--#include virtual= "/learn/test/lib_graphicdetect.asp"-->
<TITLE>dbtable.asp</TITLE>
<body bgcolor= "#FFFFFF" >
<%
Graphic= "Images/learnaspiconmain.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>


The library is included:

<%
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
&n



Related Article

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.