fix(水印): 添加水印后编码图片时漏掉了保存质量参数 (#856)

Co-authored-by: zhendery <zhendery@qq.com>
This commit is contained in:
zhendery 2025-02-15 02:36:56 +08:00 committed by GitHub
parent effe173d9c
commit 011b291e05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,7 +167,8 @@ class Controller extends BaseController
$configs->get('mode', Mode::Overlay) == Mode::Dynamic &&
! in_array($image->extension, ['ico', 'gif', 'svg'])
) {
$contents = $service->stickWatermark($contents, $configs)->encode()->getEncoded();
$quality = $image->group?->configs->get(GroupConfigKey::ImageSaveQuality, 75);
$contents = $service->stickWatermark($contents, $configs)->encode($image->extension, $quality)->getEncoded();
}
$cacheTtl = (int)$image->group?->configs->get(GroupConfigKey::ImageCacheTtl, 0);
// 是否启用了缓存