当前位置: 代码迷 >> PHP >> php 按最大尺度 等比例缩放图片
  详细解决方案

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

热度:43   发布时间:2016-04-28 22:48:24.0
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;		        			        }
?
  相关解决方案