//这个是javascript 实现网页图片等比例缩放 按边框大小等比多于隐藏
function DrawImage(ImgD,imgwidth,imgheight){   
         var image=new Image();   
         image.src=ImgD.src;   
         if(image.width>0 && image.height>0 ){
		 	var rate = (imgwidth/image.width < imgheight/image.height) ? imgwidth/image.width:imgheight/image.height; 
		 	if(image.height<image.width){   
					   if(rate <= 1){ 
					  		if(imgwidth/imgheight>image.width/image.height){
								ImgD.width = imgwidth;
								}
							else{
								ImgD.height = imgheight;
								}
						 //ImgD.width = image.width*rate;   
						 
						 //image.height*rate;   
					   } else {   
						 ImgD.width = image.width;   
						 ImgD.height =image.height;   
					   } 
		    }
         	else{
		     if(rate <= 1){  
			 	if(imgwidth/imgheight>image.width/image.height){
								ImgD.width = imgwidth;
								}
							else{
								ImgD.height = imgheight;
								}
             //ImgD.width = imgwidth;
			 //image.width*rate;   
             //ImgD.height = image.height*rate;   
           } else {   
             ImgD.width = image.width;   
             ImgD.height =image.height;   
           }
		   }   
       }
	   }

//这个是javascript 实现网页图片等比例缩放
function DrawImagea(ImgD,FitWidth,FitHeight)
{
 var image=new Image();
 image.src=ImgD.src;
 if(image.width>0 && image.height>0){
  if(image.width/image.height>= FitWidth/FitHeight){
   if(image.width>FitWidth){
    ImgD.width=FitWidth;
    ImgD.height=(image.height*FitWidth)/image.width;
   }else{
    ImgD.width=image.width;
    ImgD.height=image.height; 
   }
  } else{
   if(image.height>FitHeight){
    ImgD.height=FitHeight;
    ImgD.width=(image.width*FitHeight)/image.height;
   }else{
    ImgD.width=image.width;
                ImgD.height=image.height;
   }
  }
 }
}
