在asp中控制图片等级缩放
来源:互联网 发布:nginx bad request 编辑:程序博客网 时间:2024/05/17 01:22
今天终于在网上找到一篇等级缩放图片的程序,现拿出来给大家分享:
在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>
<!--
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="链接地址" target="_blank"><img src="图片地直址" border="0" onload="javascript:DrawImage(this);"></a>
经测试非常稳定,希望能帮助更多人解决这个问题。。。
- 在asp中控制图片等级缩放
- 在C#中实现图片缩放(含asp.net用鼠标滚轮实现图片缩放)
- css3 来实现图片在指定容器内等比例缩放,并控制中上下左右居中
- css3 来实现图片在指定容器内等比例缩放,并控制中上下左右居中
- ASP控制图片显示的大小(等比例缩放)
- javascript控制图片缩放
- canvas控制图片缩放
- 图片比例缩放控制
- 如何在C#中实现图片缩放
- 如何在C#中实现图片缩放
- 如何在C#中实现图片缩放
- 如何在C#中实现图片缩放
- 如何在C#中实现图片缩放
- 如何在C#中实现图片缩放
- 在iPhone中实现图片缩放
- 如何在C#中实现图片缩放
- java 鼠标控制图片缩放
- canvas 图片中心缩放 控制
- 中国未来可能面临的第四次失业浪潮
- ClearCase Config_Spec 之如何利用Config_Spec
- perl常用函数(适合初学者)!
- .NET也有ORM--Grove一览
- x264编码详细文字全过程
- 在asp中控制图片等级缩放
- 博弈论与现代企业管理
- It is a fine day today ,isnt it
- ASP漏洞全接触-入门篇
- 一些财务的指标解释
- [ZT FROM CHINAITLAB] GWT和ECHO2的对比
- 用openssl编写SSL,TLS程序
- ASP漏洞全接触-进阶篇
- 用XCOPY进行源代码备份