代码如下:
if($toWH<=$srcWH){
$ftoW=$toW;
$ftoH=$ftoW*($srcH/$srcW);
}
else{
$ftoH=$toH;
$ftoW=$ftoH*($srcW/$srcH);
}
代码如下:
$ftoH=$toH;
$ftoW=$toW;
if ($toWH<=$srcWH) {
$src_Y = 0;
$src_X = ($srcW-$srcH*$toWH)/2;
$srcW = $srcH*$toWH;
} else {
$src_X = 0;
$src_Y = ($srcH-$srcW/$toWH)/2;
$srcH = $srcW/$toWH;
}
代码如下:
($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH)
代码如下:
($ni,$im,0,0,$src_X,$src_Y,$ftoW,$ftoH,$srcW,$srcH)