|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
实现规模效益。与传统的用户拥有硬件软件所有权和使用权以及传统的应用服务商提供一对一的服务模式不同,ASP拥有应用系统所有权,用户拥有使用权,应用系统集中放在ASP的数据中心中,集中管理,分散使用,以一对多的租赁的形式为众多用户提供有品质保证的应用技术服务,实现规模效益。程序|源代码|源代码<%
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)
%></p>ASP.NET和ASP的比较,技术上比较已经没什么可说的了.新一代在大部分程度来说当然是比旧一代好了.关键看你对所做软件的理解了.因人而定.会写的话也可能比ASP.NET写得更有效率和更方便重用 |
|