- <!--#includevirtual="/learn/test/lib_graphicdetect.asp"-->
- <html><head>
- <TITLE>dbtable.asp</TITLE>
- </head>
- <bodybgcolor="#FFFFFF">
- <%
- graphic="images/learnaspiconmain.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>
- Thelibrarythatisincludedis:
- <%
- DimHW
- FunctionAscAt(s,n)
- AscAscAt=Asc(Mid(s,n,1))
- EndFunction
- FunctionHexAt(s,n)
- HexHexAt=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
- decimaldecimal=decimal*16
- IfisDigit(c)Then
- decimaldecimal=decimal+ch
- Else
- decimaldecimal=decimal+Asc(uCase(ch))-Asc("A")
- EndIf
- Else
- HexToDec=-1
- EndIf
- Next
- HexToDec=decimal
- EndFunction
- %>