一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

当服务器不支持图片切割组件我们怎么办?

时间:2008-01-12 编辑:简简单单 来源:一聚教程网

#######################################
本文章属于[雨浪]版权所有,转载必须声明
#######################################
最近做网站图片版块,由于虚拟主机不支持他方组件,无奈。
图片版块的排版成了大问题。经过仔细分析。网上图片一般
为图片集。也就是说一些相关的图片都是差不多大小。
好办了!!!!
图片的长与宽都是有比例的。如果我们从数据库中查找出比例相似的
的图片便很好把排版的问题解决了
图片的长宽可以在上传时通过如下代码取得:
建立类:
Class imgInfo
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
err.clear
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)
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)
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)
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)
dim ret
ret = 0
for i = 1 to lenb(bin)
ret = ret *256 + ascb(midb(bin,i,1))
next
BinVal2=ret
End Function
Private Function getImageSize(filespec)

热门栏目