if isNull(bFlag) then
ret(0) = "unknow"
ret(1) = 0
ret(2) = 0
getimagewh = ret
Exit Function
end if
'取文件类型和长宽
select case hex(binVal(bFlag))
case "4E5089":
ADOS.read(15)
ret(0) = "png"
ret(1) = BinVal2(ADOS.read(2))
ADOS.read(2)
ret(2) = BinVal2(ADOS.read(2))
case "464947":
ADOS.read(3)
ret(0) = "gif"
ret(1) = BinVal(ADOS.read(2))
ret(2) = BinVal(ADOS.read(2))
case "FFD8FF":
dim p1
do
do: p1 = binVal(ADOS.Read(1)): loop while p1 = 255 and not ADOS.EOS
if p1 > 191 and p1 < 196 then exit do else ADOS.read(binval2(ADOS.Read(2))-2)
do:p1 = binVal(ADOS.Read(1)):loop while p1 < 255 and not ADOS.EOS
loop while true
ADOS.Read(3)
ret(0) = "jpg"
ret(2) = binval2(ADOS.Read(2))
ret(1) = binval2(ADOS.Read(2))
case else:
if left(Bytes2bStr(bFlag),2) = "BM" then
ADOS.Read(15)
ret(0) = "bmp"
ret(1) = binval(ADOS.Read(4))
ret(2) = binval(ADOS.Read(4))
else
ret(0) = ""
end if
ADOS.Close
Set ADOS = Nothing
end select
Select case ret(0)
case "png","jpg","bmp","gif"
ret(1) = ret(1)
ret(2) = ret(2)
ret(0) = ret(0)
case else
ret(1) = 0
ret(2) = 0
ret(0) = "unknow"
end select
getimageWH = ret
End Function
Function GetWebData(StrUrl)
'获得INTERNET上的图片二进制数据
On Error Resume Next
if StrUrl="" then
GetWebData = ""
exit function
end if
dim tempStr
tempStr=split(StrUrl,"/")
if tempStr(ubound(tempStr))="" or inStr(StrUrl,"/")=0 then
GetWebData = ""
exit function
end if
dim Retrieval
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", StrUrl, False, "", ""
.Send
GetWebData =.ResponseBody
End With
Set Retrieval = Nothing
If Err.Number <> 0 Then Err.Clear