
function proDownImage(ImgD){
var proMaxHeight = 300;
var proMaxWidth  = 200;
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
var rate = (proMaxWidth/image.width < proMaxHeight/image.height)?proMaxWidth/image.width:proMaxHeight/image.height;
       //如果 指定高度/图片高度  小于  指定宽度/图片宽度 ，  那么，我们的比例数 取 指定高度/图片高度。
   //如果 指定高度/图片高度  大于  指定宽度/图片宽度 ，  那么，我们的比例数 取 指定宽度/图片宽度。
if(rate <= 1){   
   ImgD.width = image.width*rate;   //图片新的宽度 = 宽度 * 比例数
   ImgD.height =image.height*rate;
}else{//  如果比例数大于1，则新的宽度等于以前的宽度。
   ImgD.width = image.width;
   ImgD.height =image.height;
}
     }
}





