Skip to content

Commit

Permalink
修正png质量 最大不超过9
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Jul 19, 2016
1 parent d126e51 commit b45055c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static function open($file)
* @param null|string $type 图像类型
* @param int $quality 图像质量
* @param bool $interlace 是否对JPEG类型图像设置隔行扫描
* @return \SplFileInfo
* @return $this
*/
public function save($pathname, $type = null, $quality = 80, $interlace = true)
{
Expand All @@ -132,7 +132,7 @@ public function save($pathname, $type = null, $quality = 80, $interlace = true)
//设定保存完整的 alpha 通道信息
imagesavealpha($this->im, true);
//ImagePNG生成图像的质量范围从0到9的
imagepng($this->im, $pathname, (int)($quality / 10));
imagepng($this->im, $pathname, max((int)($quality / 10), 9));
} else {
$fun = 'image' . $type;
$fun($this->im, $pathname);
Expand Down

0 comments on commit b45055c

Please sign in to comment.