zl程序教程

您现在的位置是:首页 >  其他

当前栏目

对文件的操作--建立移动删除文件夹

文件 操作 删除 建立 -- 文件夹 移动
2023-06-13 09:13:46 时间
下面两个文件:
<!--#includevirtual="/intels/chunfeng/graphicdetect.asp"-->
<html>
<head>
<TITLE>图像尺寸</TITLE>
</head>
<bodybgcolor="#FFFFFF">
<%
graphic="images/intels.gif"
HW=ReadImg(graphic)
Response.Writegraphic&"Dimensions:"&HW(0)&"x"&HW(1)
&"<br>"
response.write"<imgsrc=""/"&graphic&""""
response.writeheight="""&HW(0)&"""
response.writewidth="""&HW(0)&"">"
%>
</body>
</html>

------------------------
graphicdetect.asp
<%
DimHW

FunctionAscAt(s,n)
AscAt=Asc(Mid(s,n,1))
EndFunction

FunctionHexAt(s,n)
HexAt=Hex(AscAt(s,n))
EndFunction

FunctionisJPG(fichero)
IfinStr(uCase(fichero),".JPG")<>0Then
isJPG=true
Else
isJPG=false
EndIf
EndFunction

FunctionisPNG(fichero)
IfinStr(uCase(fichero),".PNG")<>0Then
isPNG=true
Else
isPNG=false
EndIf
EndFunction

FunctionisGIF(fichero)
IfinStr(uCase(fichero),".GIF")<>0Then
isGIF=true
Else
isGIF=false
EndIf
EndFunction

FunctionisBMP(fichero)
IfinStr(uCase(fichero),".BMP")<>0Then
isBMP=true
Else
isBMP=false
EndIf
EndFunction

FunctionisWMF(fichero)
IfinStr(uCase(fichero),".WMF")<>0Then
isWMF=true
Else
isWMF=false
EndIf
EndFunction

FunctionisWebImg(f)
IfisGIF(f)OrisJPG(f)OrisPNG(f)OrisBMP(f)OrisWMF(f)
Then
isWebImg=true
Else
isWebImg=true
EndIf
EndFunction

FunctionReadImg(fichero)
IfisGIF(fichero)Then
ReadImg=ReadGIF(fichero)
Else
IfisJPG(fichero)Then
ReadImg=ReadJPG(fichero)
Else
IfisPNG(fichero)Then
ReadImg=ReadPNG(fichero)
Else
IfisBMP(fichero)Then
ReadImg=ReadPNG(fichero)
Else
IfisWMF(fichero)Then
ReadImg=ReadWMF(fichero)
Else
ReadImg=Array(0,0)
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunction

FunctionReadJPG(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=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
EndFunction

FunctionReadPNG(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=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
EndFunction

FunctionReadGIF(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=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
EndFunction


FunctionReadWMF(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=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
EndFunction

FunctionReadBMP(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=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
EndFunction

FunctionisDigit(c)
IfinStr("0123456789",c)<>0Then
isDigit=true
Else
isDigit=false
EndIf
EndFunction

FunctionisHex(c)
IfinStr("0123456789ABCDEFabcdef",c)<>0Then
isHex=true
Else
ishex=false
EndIf
EndFunction

FunctionHexToDec(cadhex)
Dimn,i,ch,decimal
decimal=0
n=Len(cadhex)
Fori=1Ton
ch=Mid(cadhex,i,1)
IfisHex(ch)Then
decimal=decimal*16
IfisDigit(c)Then
decimal=decimal+ch
Else
decimal=decimal+Asc(uCase(ch))-Asc("A")
EndIf
Else
HexToDec=-1
EndIf
Next
HexToDec=decimal
EndFunction
%>