$maxWidth = 180;//最大宽度 $maxHeight = 125; //最大高度 $iSuofang = $arrPicwh['w']/$arrPicwh['h'];//原图的比例 $iSuo = $arrPicwh['h']/$arrPicwh['w']; if ($arrPicwh['w'] > $arrPicwh['h'])//判断原图的宽高那个大 { $dstW = $maxWidth; $dstH = $maxWidth * $iSuo; }else { $dstH = $maxHeight; $dstW = $maxHeight * $iSuofang; }?