Skip to content

Commit b45055c

Browse files
committed
修正png质量 最大不超过9
1 parent d126e51 commit b45055c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public static function open($file)
111111
* @param null|string $type 图像类型
112112
* @param int $quality 图像质量
113113
* @param bool $interlace 是否对JPEG类型图像设置隔行扫描
114-
* @return \SplFileInfo
114+
* @return $this
115115
*/
116116
public function save($pathname, $type = null, $quality = 80, $interlace = true)
117117
{
@@ -132,7 +132,7 @@ public function save($pathname, $type = null, $quality = 80, $interlace = true)
132132
//设定保存完整的 alpha 通道信息
133133
imagesavealpha($this->im, true);
134134
//ImagePNG生成图像的质量范围从0到9的
135-
imagepng($this->im, $pathname, (int)($quality / 10));
135+
imagepng($this->im, $pathname, max((int)($quality / 10), 9));
136136
} else {
137137
$fun = 'image' . $type;
138138
$fun($this->im, $pathname);

0 commit comments

Comments
 (0)