1 function CheckProperty(imagesrc,edge) //检测图像属性
2 { var Obj = new Image();
3 Obj.src = imagesrc;
4 ImgWidth = Obj.width //取得图片的宽度
5 ImgHeight = Obj.height; //取得图片的高度
6 var width_a = ImgWidth/edge;
7 var height_a = ImgHeight/edge;
8 var times = (width_a>height_a) ? width_a : height_a;
9 Obj.width = ImgWidth/times;
10 Obj.height = ImgHeight/times;
11 html ="<image height=\"" +ImgHeight/times +"\"/>";
12 document.write(html);
13 return { "width":ImgWidth ,"height":ImgHeight }
14 }
2 { var Obj = new Image();
3 Obj.src = imagesrc;
4 ImgWidth = Obj.width //取得图片的宽度
5 ImgHeight = Obj.height; //取得图片的高度
6 var width_a = ImgWidth/edge;
7 var height_a = ImgHeight/edge;
8 var times = (width_a>height_a) ? width_a : height_a;
9 Obj.width = ImgWidth/times;
10 Obj.height = ImgHeight/times;
11 html ="<image height=\"" +ImgHeight/times +"\"/>";
12 document.write(html);
13 return { "width":ImgWidth ,"height":ImgHeight }
14 }