利用aSP获得图象的实际尺寸的示例
来源:互联网 发布:电脑打字软件哪个好 编辑:程序博客网 时间:2024/04/30 17:39
利用aSP获得图象的实际尺寸的示例
<!--#include virtual="/learn/test/lib_graphicdetect.asp"--><html><head><TITLE>dbtable.asp</TITLE></head><body bgcolor="#FFFFFF"><% graphic="images/learnaspiconmain.gif" HW = ReadImg(graphic) Response.Write graphic & " Dimensions: " & HW(0) & "x" & HW(1) & "<br>" response.write "<img src=""/" & graphic & """" response.write height=""" & HW(0) & """ response.write width=""" & HW(0) & "">"%></body></html>The library that is included is:<%Dim HWFunction AscAt(s, n) AscAt = Asc(Mid(s, n, 1))End FunctionFunction HexAt(s, n) HexAt = Hex(AscAt(s, n))End FunctionFunction isJPG(fichero) If inStr(uCase(fichero), ".JPG") <> 0 Then isJPG = true Else isJPG = false End IfEnd FunctionFunction isPNG(fichero) If inStr(uCase(fichero), ".PNG") <> 0 Then isPNG = true Else isPNG = false End IfEnd FunctionFunction isGIF(fichero) If inStr(uCase(fichero), ".GIF") <> 0 Then isGIF = true Else isGIF = false End IfEnd FunctionFunction isBMP(fichero) If inStr(uCase(fichero), ".BMP") <> 0 Then isBMP = true Else isBMP = false End IfEnd FunctionFunction isWMF(fichero) If inStr(uCase(fichero), ".WMF") <> 0 Then isWMF = true Else isWMF = false End IfEnd FunctionFunction isWebImg(f) If isGIF(f) Or isJPG(f) Or isPNG(f) Or isBMP(f) Or isWMF(f) Then isWebImg = true Else isWebImg = true End IfEnd FunctionFunction 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 IfEnd FunctionFunction 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 = HWEnd FunctionFunction 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 = HWEnd FunctionFunction 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 = HWEnd FunctionFunction 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 = HWEnd FunctionFunction 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 = HWEnd FunctionFunction isDigit(c) If inStr("0123456789", c) <> 0 Then isDigit = true Else isDigit = false End IfEnd FunctionFunction isHex(c) If inStr("0123456789ABCDEFabcdef", c) <> 0 Then isHex = true Else ishex = false End IfEnd FunctionFunction 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 = decimalEnd Function%>
- 利用aSP获得图象的实际尺寸的示例
- 利用ASP获得图象的实际尺寸的示例
- 如何获知页面上的图象的实际尺寸
- 如何获知页面上的图象的实际尺寸?
- 获得jpg文件的实际尺寸
- Excel 单元格的实际尺寸
- 利用反射获得泛型的实际类型参数
- 一个获得窗口图象的函数
- C++Builder 中大尺寸图象的显示技巧
- C++Builder中大尺寸图象的显示技巧
- C++Builder中大尺寸图象的显示技巧
- C++Builder中大尺寸图象的显示技巧
- jquery获取页面图片的实际尺寸
- 关于ASP图象问题的总结
- Delphi中一个获得窗口图象的函数
- ASP利用TCPIP.DNS组件获得域名对应的IP
- 获得图片文件的图像尺寸大小
- Android 中获得屏幕的像素尺寸
- Linux指令大全(3)
- 在下拉框中显示树形菜单
- 用aSP发 WaP MaIL(=)
- Linux 远程GUI 访问的应用(图)
- 华人企业最成功的老外打工仔
- 利用aSP获得图象的实际尺寸的示例
- aSP与JSP的比较(二)
- 在新家过夜
- 人民币小写转换为大写
- 目前可以升级的windows2003序列号-企业版
- aSP读取XML数据文件的方法
- 自问自答(1) 2008-6-15
- C#利用WMI操作DNS服务器(可远程操作,需要相应权限)
- 在asp中不借助第三方组件抓取别的站点的页面