|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我想详细了解ASP整站代码与PSP整站代码有什么优缺点,那个更好,更安全,更用容易维护,和管理。。。缩小<%
ClassDealImgSize
dimaso
PrivateSubClass_Initialize
setaso=CreateObject("Adodb.Stream")
aso.Mode=3
aso.Type=1
aso.Open
EndSub
PrivateSubClass_Terminate
setaso=nothing
EndSub
PrivateFunctionBin2Str(Bin)
DimI,Str,clow
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
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
FunctiongetImageSize(filespec)
dimret(2),bFlag,p1
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"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
getImageSize=ret
EndFunction
FunctionResize(ow,oh,rw,rh)
dimwh(1)
ifcint(ow)>cint(oh)then
ifcint(ow)>cint(rw)then
wh(0)=rw
wh(1)=int(oh/(ow/rw))
else
wh(0)=ow
wh(1)=oh
endif
else
ifcint(oh)>cint(rh)then
wh(0)=int(ow/(oh/rh))
wh(1)=rh
else
wh(0)=ow
wh(1)=oh
endif
endif
Resize=wh
EndFunction
EndClass
%>
********************
利用办法
********************
<%
Dimaa
Setaa=newDealImgSize
Dimpw,ph,rpw,rph
pw=aa.getImageSize(Server.MapPath("01.jpg"))(1)
ph=aa.getImageSize(Server.MapPath("01.jpg"))(2)
rpw=aa.Resize(pw,ph,160,120)(0)
rph=aa.Resize(pw,ph,160,120)(1)
Response.Write("<imgsrc="http://www.webjx.com/01.jpg"width="&rpw&"height="&rph&">")
Setaa=Nothing
%>
ASP最大的缺点在于网络的安全性和可靠性,企业将经营数据放在开放的平台上,最大的担忧就是如何保证这些数据不被其他人破坏。 |
|