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

@@ -312,7 +312,9 @@ func (handler *Driver) Thumb(ctx context.Context, file *model.File) (*response.C
return nil, errors.New("failed to get thumbnail size")
}
thumbParam := fmt.Sprintf("image/resize,m_lfit,h_%d,w_%d", thumbSize[1], thumbSize[0])
thumbEncodeQuality := model.GetIntSetting("thumb_encode_quality", 85)
thumbParam := fmt.Sprintf("image/resize,m_lfit,h_%d,w_%d/quality,q_%d", thumbSize[1], thumbSize[0], thumbEncodeQuality)
ctx = context.WithValue(ctx, fsctx.ThumbSizeCtx, thumbParam)
thumbOption := []oss.Option{oss.Process(thumbParam)}
thumbURL, err := handler.signSourceURL(