You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.
public function save($imgname, $type = null, $quality = 80, $interlace = true)
{
if (empty($this->img)) {
E('没有可以被保存的图像资源');
}
//自动获取图像类型
if (is_null($type)) {
$type = $this->info['type'];
} else {
$type = strtolower($type);
}
//保存图像
if ('jpeg' == $type || 'jpg' == $type) {
//JPEG图像设置隔行扫描
imageinterlace($this->img, $interlace);
imagejpeg($this->img, $imgname, $quality);
} elseif ('gif' == $type && !empty($this->gif)) {
$this->gif->save($imgname);
} elseif ('png' == $type) {
//设定保存完整的 alpha 通道信息
imagesavealpha($this->img, true);
//ImagePNG生成图像的质量范围从0到9的
imagepng($this->img, $imgname, $quality / 10);
} else {
$fun = 'image' . $type;
$fun($this->img, $imgname);
}
}
因为图片质量传100的时候,png的质量就是10了,此时将正常无法保存png图片
解决办法:可将上面字体加粗的地方可改为
imagepng($this->img, $imgname, ($quality-10) / 10)
The text was updated successfully, but these errors were encountered: