Settings | Sign in | Sign up

The author has 1 post.

【代码】javascript按比例缩小图片

Floor 1 产品的注销 12/19/10 10:57
function qmd_size(that){
 var new_width=436;
 var new_height=200;
 var src_width=that.width;
 var src_height=that.height;
 if (src_width>new_width || src_height>new_height){
  var radio=Math.max((src_width/new_width),(src_height/new_height));
  var width=Math.ceil(src_width/radio);
  var height=Math.ceil(src_height/radio);
  that.width=width;
  that.height=height;
 }return{
  width:width, //宽
  height:height //高
 }
}

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.