Add: thumb quality for 3rd storage policy (#1763)

Add thumb quality for third party storage policy.
This commit is contained in:
Darren Yu
2023-07-05 22:13:24 +08:00
committed by GitHub
parent ce759c02b1
commit a26893aabc
4 changed files with 15 additions and 6 deletions

View File

@@ -234,9 +234,12 @@ func (handler Driver) Thumb(ctx context.Context, file *model.File) (*response.Co
ok = false
)
if thumbSize, ok = ctx.Value(fsctx.ThumbSizeCtx).([2]uint); !ok {
return nil, errors.New("无法获取缩略图尺寸设置")
return nil, errors.New("failed to get thumbnail size")
}
thumbParam := fmt.Sprintf("imageMogr2/thumbnail/%dx%d", thumbSize[0], thumbSize[1])
thumbEncodeQuality := model.GetIntSetting("thumb_encode_quality", 85)
thumbParam := fmt.Sprintf("imageMogr2/thumbnail/%dx%d/quality/%d", thumbSize[0], thumbSize[1], thumbEncodeQuality)
source, err := handler.signSourceURL(
ctx,