php图片等比例缩放
发布时间:2015-10-15, 12:20:41 分类:PHP | 编辑 off 网址 | 辅助
正文 424字数 148,587阅读
<?php
$filename="q.jpg";
$per=0.3;
list($width, $height)=getimagesize($filename);
$n_w=$width*$per;
$n_h=$height*$per;
$new=imagecreatetruecolor($n_w, $n_h);
$img=imagecreatefromjpeg($filename);
//拷贝部分图像并调整
imagecopyresized($new, $img,0, 0,0, 0,$n_w, $n_h, $width, $height);
//图像输出新图片、另存为
imagejpeg($new, "q1.jpg");
imagedestroy($new);
imagedestroy($img);
?>
Run code
Cut to clipboard
(支付宝)给作者钱财以资鼓励 (微信)→
暂无评论 »