mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
refactor(encoder): optimize extra image processing parameters handling
This commit is contained in:
parent
ffa5242983
commit
e11cd575c8
@ -216,13 +216,18 @@ func preProcessImage(img *vips.ImageRef, imageType string, extraParams config.Ex
|
|||||||
|
|
||||||
// 额外参数处理
|
// 额外参数处理
|
||||||
if config.Config.EnableExtraParams {
|
if config.Config.EnableExtraParams {
|
||||||
log.Debug("开始应用额外图像处理参数")
|
// 检查是否需要进行尺寸调整
|
||||||
if err := resizeImage(img, extraParams); err != nil {
|
if extraParams.MaxWidth != 0 || extraParams.MaxHeight != 0 || extraParams.Width != 0 || extraParams.Height != 0 {
|
||||||
log.Errorf("应用额外图像处理参数失败: %v", err)
|
log.Debug("开始应用额外图像处理参数")
|
||||||
// 这里不设置 shouldCopyOriginal 为 true,因为我们不想在这种情况下复制原图
|
if err := resizeImage(img, extraParams); err != nil {
|
||||||
return shouldCopyOriginal, err
|
log.Errorf("应用额外图像处理参数失败: %v", err)
|
||||||
|
// 这里不设置 shouldCopyOriginal 为 true,因为我们不想在这种情况下复制原图
|
||||||
|
return shouldCopyOriginal, err
|
||||||
|
}
|
||||||
|
log.Debug("额外图像处理参数应用完成")
|
||||||
|
} else {
|
||||||
|
log.Debug("未设置任何尺寸参数,跳过图像尺寸调整")
|
||||||
}
|
}
|
||||||
log.Debug("额外图像处理参数应用完成")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug("图像预处理完成")
|
log.Debug("图像预处理完成")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user