| ·好听的歌 | ·火影忍者 | ·繁体字转换 | ·在线听歌 | ·火影忍者漫画 | ·最新歌曲 | ·psp游戏下载 | ·photoshop | ·火星文 |
Asp无组件生成缩略图
作者:feng_sun… 文章来源:本站原创 点击数: 更新时间:2005-10-23
3.定义缩略图尺寸
这部分代码就是仁者见仁,智者见智了。首先,我们需要规定缩略图显示尺寸范围,譬如:300X260,代码可以这样写:
《%
Dim PXWidth,PXHeight
Dim Pp '//Proportion
If PWidth=0 Or PWidth="" Then
PXWidth=0
PXHeight=0
Else
Pp=FormatNumber(PWidth/PHeight,2) '//长宽比
End If
If PWidth>=PHeight Then
If PWidth>=300 Then
PXWidth=300
PXHeight=FormatNumber(300/Pp,0)
Else
PXWidth=PWidth
PXHeight=PHeight
End If
Else
If PHeight>=260 Then
PXHeight=260
PXWidth=FormatNumber(260*Pp,0)
Else
PXWidth=PWidth
PXHeight=PHeight
End If
End If
%》
将上面的代码紧接第二步写下即可。调用时代码如下:
《img src=《%=curfilename%》 border="0" width=《%=PXWidth%》
height=《%=PXHeight%》》
至于图片格式可以用得到,图片尺寸可以写成
《%
response.write PXWidth&"X"&PXHeight
%》
图片大小可以用FSO.GetFileSize(filename)来实现,而点击次数可以简单地用SQL语句实现,具体编码就不再累述了。
这样,一个无组件生成缩略图程序就写好了,可能有点拿来主义,不过只要大家能将方法掌握相信还是有很大提高的。
丁丁注:把《》换成<>
网友评论
(评论内容只代表网友观点,与本站立场无关!)
相关文章
推荐文章
热门文章
您现在的位置: 


