读书人

php 按最大尺度 等比例缩放图片

发布时间: 2012-12-25 16:18:28 作者: rapoo

php 按最大尺寸 等比例缩放图片

    $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;                }
?

读书人网 >PHP

热点推荐