Function Bytes2bStr(vin)
if lenb(vin) =0 then
Bytes2bStr = ""
exit function
end if
''二进制转换为字符串
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
BytesStream.Type = 2
BytesStream.Open
BytesStream.WriteText vin
BytesStream.Position = 0
BytesStream.Charset = "gb2312"
BytesStream.Position = 2
StringReturn = BytesStream.ReadText
BytesStream.close
Set BytesStream = Nothing
Bytes2bStr = StringReturn
End Function
Function BinVal(bin)
Dim i
Dim ret:ret = 0
for i = lenb(bin) to 1 step -1
ret = ret *256 + ascb(midb(bin,i,1))
next
BinVal = ret
End Function
Function BinVal2(bin)
Dim i
Dim ret:ret = 0
for i = 1 to lenb(bin)
ret = ret *256 + ascb(midb(bin,i,1))
next
BinVal2 = ret
End Function
Function getImageWH(fdata)
'一个实参fdata,二进制图象数据(至于怎么读取图象的二进制数据就不用说了吧-_-!)
'返回值为一个数组,3个元素,分别为图片格式.长.宽
dim ret(2),bFlag,fsize,ADOS
fsize=clng(lenb(fdata)) '取得数据尺寸
if fsize=0 then Exit Function
Set ADOS = Server.CreateObject("ADODB.Stream")
ADOS.Type = 1
ADOS.Mode = 3
ADOS.Open
ADOS.Write fdata
ADOS.Position = 0
'写文本对象读取图像长宽和类型
ADOS.Position = 0 '重置数据开始位置
bFlag = ADOS.read(3)
if isNull(bFlag) then