When you upload a picture or display SWF, you want to get its height and width basic principles use the adoDb.stream read binary and then parses, then return an array of the first element as the type (BMP JPG PNG GIF SWF) second element is Width {width} The third element is high {height} fourth element is width = {width}, height = {height} character string Class = {height} style class qswhimg Dim Aso Private Sub class_initialize set aso = createObject ("adodb.stream") Aso.mode = 3 asbo.type = 1 aso.open end sub private sub class_terminate 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) 'qiushuiwuhen (2002-8-12) 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) 'qiushuiwuhen (2002 -8-12) DIM RET 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) 'qiushuiwuhen (2002-8-12) DIM RET RET = 0 for i = lenb (bin) to 1 step -1 return = RET * 256 ASCB (MIDB (BIN, I, 1)) Next binval = RET END FUNT BINVAL = RET End Function Private Function Binval2 (bin) 'qiushuiwuhen (2002-8-12) DIM RET RET = 0 for i = 1 to lenb (bin) RET = RET * 256 ASCB (MIDB (MIDB Bin, I, 1)) Next Binval2 = RET End binval2 = RET End Function Function GetImagesize (filespec) 'qiushuiwuhen (2002-9-3) DIM RET (3) ASO.LOADFROMFILE (filespec) bflag =
Aso.read (3) Select Case Hex (Binval (Bflag)) Case "4E5089": aso.read (15) RET (0) = "PNG" RET (1) = binval2 (ASO.READ (2)) ASO. READ (2) RET (2) = binval2 (ASO.READ (2)) Case "464947": aso.read (3) RET (0) = "gif" Ret (1) = binval (ASO.READ (2) RET (2) = binval (ASO.READ (2)) Case "535746": aso.read (5) bindata = aso.read (1) SCONV = Num2Str (ASCB (Bindata), 2, 8) nbits = str2num (Left (SCONV, 5), 2) SCONV = MID (SCONV, 6) While (LEN (SCONV)