$arr=getimagesize("images/album_01.gif"); echo $arr[3]; $strarr=explode(""",$arr[3]); echo $strarr[1]; ?>
演示图片等比例缩小 <script> <BR>function Wa_SetImgAutoSize(img) <BR>{ <BR>//var img=document.all.img1;//获取图片 <BR>var MaxWidth=200;//设置图片宽度界限 <BR>var MaxHeight=100;//设置图片高度界限 <BR>var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比 <BR>var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比 <BR>alert("test"+img.offsetHeight+img.fileSize);<BR>if(img.offsetHeight>1) alert(img.offsetHeight);<BR>if(img.readyState!="complete"){<BR> return false;//确保图片完全加载<BR>}<P>if(img.offsetWidth>MaxWidth){ <BR>img.width=MaxWidth; <BR>img.height=MaxWidth*HeightWidth; <BR>} <BR>if(img.offsetHeight>MaxHeight){ <BR>img.height=MaxHeight; <BR>img.width=MaxHeight*WidthHeight; <BR>} <BR>} <P>function CheckImg(img) <BR>{ <BR> var message="";<BR> var MaxWidth=1;//设置图片宽度界限 <BR> var MaxHeight=1;//设置图片高度界限 <BR> <BR> if(img.readyState!="complete"){<BR> return false;//确保图片完全加载<BR> }<BR> if(img.offsetHeight>MaxHeight) message+="高度超额:"+img.offsetHeight;<BR> if(img.offsetWidth>MaxWidth) message+="宽度超额:"+img.offsetWidth;<BR> if(message!="") alert(message);<BR>} <BR></script>
http://www.bkjia.com/PHPjc/508694.html www.bkjia.com true http://www.bkjia.com/PHPjc/508694.html TechArticle ? arr=getimagesize("images/album_01.gif"); echo arr[3]; strarr=explode(""",arr[3]); echo strarr[1]; ? HTML HEAD TITLE演示图片等比例缩小/TITLE script function Wa_SetImgAuto...