Function Bytes2bStr (vin)
If lenb (vin) = 0 then
Bytes2bStr = ""
Exit function
End if
''Binary conversion to string
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)
'One real parameter fdata: binary image data (as for how to read the binary data of an image, you don't have to say -_-!)
'Return value is an array with three elements in the image format. length and width.
Dim ret (2), bFlag, fsize, ADOS
Fsize = clng (lenb (fdata) 'get the data size
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
'Write Text object read image width and type
ADOS. Position = 0' reset data start Position
BFlag = ADOS. read (3)
If isNull (bFlag) then