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

WBOY
Release: 2016-06-13 13:02:31
Original
1014 people have browsed it

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;
		        	
		        }
Copy after login
?
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template