This article provides three kinds of pictures to shrink the code proportionally, one is to use the CSS tutorial to force the picture scaling down, after two is to use the Web page effects on the picture proportionally to shrink the code
<html xmlns= "http://www.jzread.com/1999/xhtml" >
<head>
<meta http-equiv= "Content-type" content= "HTML; charset=gb2312 "/>
<title> image Scaling (CSS mandatory) page special effects code </title>
<style>
<!--CSS to force a proportional reduction of the picture, in many cases, without this method, will increase the IE load. -->
. thumbimage {
max-width:50px;
max-height:50px;
}
* HTML. Thumbimage {
Width:expression (This.width > && this.width > This.height 50:true);
Height:expresion (This.height > 50:true);
}
</style>
</head>
<body>
<img src= "/jscss/demoimg/wall3.jpg" >
</body>
</html>
Yahoo picture's scaled down code::
<script type= "text/web Effects" >
function Setimgsize (img,width,height) {
var maxwidth=width;//set Picture width limit
var maxheight=height;//set Picture height limit
var heightwidth=img.offsetheight/img.offsetwidth;//set aspect ratio
var widthheight=img.offsetwidth/img.offsetheight;//set ratio of width to height
if (img.offsetwidth>maxwidth) {
Img.width=maxwidth;
Img.height=maxwidth*heightwidth;
}
if (img.offsetheight>maxheight) {
Img.height=maxheight;
Img.width=maxheight*widthheight;
}
}
</script>
Uses: <img src= "/www.jzread.com/logo-yy.gif" border=0 onload= "setimgsize (this,132,160);"
<script language= "Web Effects" >
<!--
var flag=false;
Function DrawImage (IMGD) {
var image=new image ();
Image.src=imgd.src;
if (image.width>0 && image.height>0) {
Flag=true;
if (image.width/image.height>= 180/110) {
if (image.width>180) {
imgd.width=180;
imgd.height= (image.height*110)/image.width;
}else{
imgd.width=image.width
imgd.height=image.height;
}
/*imgd.alt= "bigpic" */
}
else{
if (image.height>110) {
imgd.height=110 ;
imgd.width= (image.width*110)/image.height;
}else{
imgd.width=image.width
imgd.height=image.height;
}
/*imgd.alt= "Bigpic"/
}
}
}
//-->
</script>
<img src= "http://www.jzread.com/skin/default/imga/logo.gif" border=0 onload= "DrawImage" (this); >
Method four pictures scaled (CSS mandatory) JS code
<img src= "..." alt= "onload=" resizeimage (this)/>
<script type= "Text/javascript" >
function Resizeimage (obj) {
Obj.width = obj.width > && obj.width > Obj.height? 50:auto;
Obj.height = obj.height > 50? 50:auto;
}
</script>