马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
因为现在数据库都使用标准的SQL语言对数据库进行管理,所以如果是标准SQL语言,两者基本上都可以通用的。SQLServer还有更多的扩展,可以用存储过程,数据库大小无极限限制。<%
ClassImgWHInfo猎取图片宽度和高度的类,撑持JPG,GIF,PNG,BMP
DimASO
PrivateSubClass_Initialize
SetASO=Server.CreateObject("ADODB.Stream")
ASO.Mode=3
ASO.Type=1
ASO.Open
EndSub
PrivateSubClass_Terminate
Err.Clear
SetASO=Nothing
EndSub
PrivateFunctionBin2Str(Bin)
DimI,Str
ForI=1ToLenB(Bin)
clow=MidB(Bin,I,1)
IfASCB(clow)<128Then
Str=Str&Chr(ASCB(clow))
Else
I=I+1
IfI<=LenB(Bin)ThenStr=Str&Chr(ASCW(MidB(Bin,I,1)&clow))
EndIf
Next
Bin2Str=Str
EndFunction
PrivateFunctionNum2Str(Num,Base,Lens)
DimRet
Ret=""
While(Num>=Base)
Ret=(NumModBase)&Ret
Num=(Num-NumModBase)/Base
Wend
Num2Str=Right(String(Lens,"0")&Num&Ret,Lens)
EndFunction
PrivateFunctionStr2Num(Str,Base)
DimRet,I
Ret=0
ForI=1ToLen(Str)
Ret=Ret*base+Cint(Mid(Str,I,1))
Next
Str2Num=Ret
EndFunction
PrivateFunctionBinVal(Bin)
DimRet,I
Ret=0
ForI=LenB(Bin)To1Step-1
Ret=Ret*256+AscB(MidB(Bin,I,1))
Next
BinVal=Ret
EndFunction
PrivateFunctionBinVal2(Bin)
DimRet,I
Ret=0
ForI=1ToLenB(Bin)
Ret=Ret*256+AscB(MidB(Bin,I,1))
Next
BinVal2=Ret
EndFunction
PrivateFunctionGetImageSize(filespec)
DimbFlag
DimRet(3)
ASO.LoadFromFile(filespec)
bFlag=ASO.Read(3)
SelectCaseHex(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)<nBits*4)
binData=ASO.Read(1)
sConv=sConv&Num2Str(AscB(binData),2,8)
Wend
ret(0)="SWF"
ret(1)=Int(Abs(Str2Num(Mid(sConv,1*nBits+1,nBits),2)-Str2Num(Mid(sConv,0*nBits+1,nBits),2))/20)
ret(2)=Int(Abs(Str2Num(Mid(sConv,3*nBits+1,nBits),2)-Str2Num(Mid(sConv,2*nBits+1,nBits),2))/20)
Case"FFD8FF":
Do
Do:p1=binVal(ASO.Read(1)):LoopWhilep1=255AndNotASO.EOS
Ifp1>191Andp1<196ThenExitDoElseASO.read(binval2(ASO.Read(2))-2)
Do:p1=binVal(ASO.Read(1)):LoopWhilep1<255AndNotASO.EOS
LoopWhileTrue
ASO.Read(3)
ret(0)="JPG"
ret(2)=binval2(ASO.Read(2))
ret(1)=binval2(ASO.Read(2))
CaseElse:
Ifleft(Bin2Str(bFlag),2)="BM"Then
ASO.Read(15)
ret(0)="BMP"
ret(1)=binval(ASO.Read(4))
ret(2)=binval(ASO.Read(4))
Else
ret(0)=""
EndIf
EndSelect
ret(3)="width="""&ret(1)&"""height="""&ret(2)&""""
getimagesize=ret
EndFunction
PublicFunctionimgW(IMGPath)
DimFSO,IMGFile,FileExt,Arr
SetFSO=Server.CreateObject("Scripting.FileSystemObject")
If(FSO.FileExists(IMGPath))Then
SetIMGFile=FSO.GetFile(IMGPath)
FileExt=FSO.GetExtensionName(IMGPath)
SelectCaseFileExt
Case"gif","bmp","jpg","png":
Arr=GetImageSize(IMGFile.Path)
imgW=Arr(1)
EndSelect
SetIMGFile=Nothing
Else
imgW=0
EndIf
SetFSO=Nothing
EndFunction
PublicFunctionimgH(IMGPath)
DimFSO,IMGFile,FileExt,Arr
SetFSO=server.CreateObject("Scripting.FileSystemObject")
If(FSO.FileExists(IMGPath))Then
SetIMGFile=FSO.GetFile(IMGPath)
FileExt=FSO.GetExtensionName(IMGPath)
SelectCaseFileExt
Case"gif","bmp","jpg","png":
Arr=getImageSize(IMGFile.Path)
imgH=Arr(2)
EndSelect
SetIMGFile=Nothing
Else
imgH=0
EndIf
SetFSO=Nothing
EndFunction
EndClass
IMGPath="Test.jpg"
SetPP=NewImgWHInfo
W=PP.imgW(Server.Mappath(IMGPath))
H=PP.imgH(Server.Mappath(IMGPath))
Setpp=Nothing
Response.Write("<imgsrc="&IMGPath&"border=0><br>宽:"&W&";高:"&H)
%>asp,你就只能等着微软给你解决,它不乐意你就只好悲催。而且asp跑在windows服务器上,windows服务器跟linux比起来简直弱爆了! |