Home  >  Article  >  Backend Development  >  php 按最大尺度 等比例缩放图片

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

WBOY
WBOYOriginal
2016-06-13 11:02:57877browse

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;		        			        }
?
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP摘引的妙用Next article:php curl容易使用