js自动生成缩略图
来源:互联网 发布:淘宝店如何升级 编辑:程序博客网 时间:2024/05/16 18:08
放入head里面
<script language="javascript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 164/112){
if(image.width>164){
ImgD.width=164;
ImgD.height=(image.height*164)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>112){
ImgD.height=112;
ImgD.width=(image.width*112)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
}
//-->
</script>
图片调用
程序代码:
<a href="<%=trim(rs("picurl"))%>" target="_blank"><img src="<%=trim(rs("imgurl"))%>" border="0" width="164" height="112" onload="javascript:DrawImage(this);"></a>
<script language="javascript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 164/112){
if(image.width>164){
ImgD.width=164;
ImgD.height=(image.height*164)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>112){
ImgD.height=112;
ImgD.width=(image.width*112)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
}
//-->
</script>
图片调用
程序代码:
<a href="<%=trim(rs("picurl"))%>" target="_blank"><img src="<%=trim(rs("imgurl"))%>" border="0" width="164" height="112" onload="javascript:DrawImage(this);"></a>
- js自动生成缩略图
- 自动生成图片缩略图的JS代码
- 自动批量生成缩略图
- C#自动生成缩略图
- 系统自动生成缩略图
- [蛙蛙推荐]用JS自动生成等比例缩略图
- 自动缩略图JS
- js 生成缩略图
- JS控制生成缩略图
- 自动生成缩略图 (文档类别:JavaScript)
- 图片上传,并自动生成缩略图!
- 用JavaScript自动生成等比例缩略图
- c#自动生成网页缩略图的方法
- php 根据url自动生成缩略图
- 组件缩略图名称、图片路径自动生成
- js上传图片,同时生成缩略图
- dwr自动生成js
- js自动生成table
- Web的桌面提醒(Popup)
- 类装入问题解密,第 4 部分: 死锁和约束
- 有关倒计时JS代码
- PHP初学者头疼问题总结
- Java 理论与实践: 用弱引用堵住内存泄漏
- js自动生成缩略图
- 如何做页面自动刷新,不用按回车键来提交数据
- 湖州市地图
- 经典管理定理之沟通
- 在工程中添加MSDE的自动安装合并模块MSM(转贴)
- 经典管理定理之激励
- 使用JavaScript创建智能表单
- web site.
- IDS与IPS