if($toWH<=$srcWH)
{
$ftoW=$toW;
$ftoH=$ftoW*($srcH/$srcW)
}
else
{
$ftoH=$toH
$ftoW=$ftoH*($srcW/$srcH)
}
|
function ImageShow(maxWidth,maxHeight,objImg){
var img=new Image();
img.src=objImg.src;
var w=img.width;
var h=img.height;
if(w==maxWidth&&h==maxHeight){
objImg.width=maxWidth;
objImg.height=maxHeight;
return
};
var b1=w/h;
var b2=maxWidth/maxHeight;
if(b1>b2){
objImg.height=maxHeight;
objImg.width=maxHeight/h*w;
objImg.style.marginLeft=-(maxHeight*w-
maxWidth*h)/(2*h)+'px'
}
else{
objImg.widt=maxWidth;
objImg.height=maxWidth/w*h;
objImg.style.margnTop=-(maxWidth*h-
maxHeight*w)/(2*w)+'px'
};
return
};
|
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: Dedecms织梦缩略图完美优化