Operations on files--establishing a move delete folder

Source: Internet
Author: User
Tags array


The following two files:
<!--#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 = Right (ts. Read (14), 4)
HW (0) = Hextodec (Hexat (s,2) & Hexat (s,1))
HW (1) = Hextodec (Hexat (s,4) & Hexat (s,3))
Ts. Close
READWMF = HW
End Function

Function readbmp (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,4) & Hexat (s,3))
HW (1) = Hextodec (Hexat (s,8) & Hexat (s,7))
Ts. Close
Readbmp = HW
End Function

Function IsDigit (c)
If inStr ("0123456789", c) <> 0 Then
IsDigit = True
Else
IsDigit = False
End If
End Function

Function Ishex (c)
If inStr ("0123456789ABCDEFabcdef", c) <> 0 Then
Ishex = True
Else
Ishex = False
End If
End Function

Function Hextodec (Cadhex)
Dim n, I, CH, decimal
decimal = 0
n = Len (Cadhex)
For I=1 to N
ch = Mid (Cadhex, I, 1)
If ishex (CH) Then
decimal = decimal * 16
If IsDigit (c) Then
decimal = decimal + ch
Else
decimal = decimal + ASC (uCase (CH))-ASC ("A")
End If
Else
Hextodec =-1
End If
Next
Hextodec = Decimal
End Function
%>




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.