Upload images or show SWFs, I hope to get its height and width.
Basic principle uses the adoDb.stream read binary then parsing, then returns a number of first elements for the first element (BMP JPG PNG GIF SWF) The second element is the width {width} The third element is high {Height} fourth Element is width = {width}, height = {height} character string
Class QSwhimg Dim Aso Private Sub Class_initialize Set Aso = CreateObject ("AdoDb.Stream") ASO.MODE = 3 Aso.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 TEN 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 * 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") & number 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 FUNT STR2NUM = RET END FUNT STR2NUM = RET End Function Private Function Binval (bin) 'qiushuiwuhen (2002-8-12) 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 Private Function Binval2 (BIN) 'qiushuiwuhen (2002-8-12) DIM RET RET = 0 for i = 1 to lenb ( BIN) RET = RET * 256 ASCB (MIDB (BIN, I, 1)) NE Xt binval2 = RET End Function Function GetImages (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)
SET FSO = CreateObject ("scripting.filesystemObject") set f = fso.getfolder (Server.mAppath (")) SET FC = F.Files for Each F1 in fc ext = fso.GETEXTENSIONNAME (F1.PATH) SELECT CASE EXT CASE "GIF", "BMP", "JPG", "PNG": arr = qswh.getimagesize (f1.path) response.write "
" & arr (0) & "& arr (3) & ":" & f1.name & "width:" & arr (1) & "height:" & arr (2) case "swf" arr = qswh.getimagesize (f1.path) response.write "
" & Arr (0) & "& Arr (3) &": "& F1.Name &" Width: "& Arr (1) &" Height: "& arr (2) end select next set fc = Nothing set f = Nothing set fso = nothing set qswh = Nothing now This article is only available at the 9CBS Document Center, if you need to reprint, please contact the author, thank you.