A class that obtains the image width and height.

Source: Internet
Author: User
Tags chr
<%
Class imgwhinfo': Class used to obtain the image width and height. JPG, GIF, PNG, and BMP are supported.
Dim ASO
Private Sub Class_Initialize
Set ASO = Server. CreateObject ("ADODB. Stream ")
ASO. Mode = 3
ASO. Type = 1
ASO. Open
End Sub
Private Sub Class_Terminate
Err. Clear
Set ASO = Nothing
End Sub

Private Function Bin2Str (Bin)
Dim I, Str
For I = 1 To LenB (Bin)
Clow = MidB (Bin, I, 1)
If ASCB (clow) <128 Then
Str = Str & Chr (ASCB (clow ))
Else
I = I + 1
If I <= LenB (Bin) Then Str = Str & Chr (ASCW (MidB (Bin, I, 1) & clow ))
End If
Next
Bin2Str = Str
End Function
Private Function Num2Str (Num, Base, Lens)
Dim Ret
Ret = ""
While (Num> = Base)
Ret = (Num Mod Base) & Ret
Num = (Num-Num Mod Base)/Base
Wend
Num2Str = Right (String (Lens, "0") & Num & Ret, Lens)
End Function
Private Function Str2Num (Str, Base)
Dim Ret, I
Ret = 0
For I = 1 To Len (Str)
Ret = Ret * base + Cint (Mid (Str, I, 1 ))
Next
Str2Num = Ret
End Function
Private Function BinVal (Bin)
Dim Ret, I
Ret = 0
For I = LenB (Bin) To 1 Step-1
Ret = Ret * 256 + AscB (MidB (Bin, I, 1 ))
Next
BinVal = Ret
End Function
Private Function BinVal2 (Bin)
Dim Ret, I
Ret = 0
For I = 1 To LenB (Bin)
Ret = Ret * 256 + AscB (MidB (Bin, I, 1 ))
Next
BinVal2 = Ret
End Function
Private Function GetImageSize (filespec)
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.