http://52.la/ChaXun/Tools/Html_Js/
1.大小图片通吃
function DownImage(ImgD){
var image=new Image();
image.src=../../ImgD.src;
if(image.width>0 && image.height>0){
//flag=true;
if(image.width>=300){
ImgD.width=300;
ImgD.height=(image.height*300)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
图片如果宽度不大于300,原始大小显示,否则缩放大小。
2.针对大图片