Using VBScript and Adodb.steam to get partial format image length and width

Source: Internet
Author: User
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)
' An argument fdata, binary mapping data (as far as how to read the binary data of the image is needless to say)-_-!
' The return value is an array, 3 elements, the picture format, respectively. Long. Wide
Dim ret (2), Bflag,fsize,ados
FSIZE=CLNG (LenB (fdata)) ' Get 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 reads image length width and type
ADOs. Position = 0 ' Reset data start position
Bflag = Ados.read (3)
If IsNull (bflag) Then

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.