1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-11-29 23:07:40 +02:00

Move WebP enforcement/preference to processing

This commit is contained in:
DarthSim
2019-06-25 15:19:15 +06:00
parent c2ce5c5850
commit 7e979a9024
2 changed files with 12 additions and 8 deletions

View File

@@ -497,11 +497,15 @@ func processImage(ctx context.Context) ([]byte, context.CancelFunc, error) {
imgtype := getImageType(ctx)
if po.Format == imageTypeUnknown {
if vipsTypeSupportSave[imgtype] {
if po.PreferWebP && vipsTypeSupportSave[imageTypeWEBP] {
po.Format = imageTypeWEBP
} else if vipsTypeSupportSave[imgtype] {
po.Format = imgtype
} else {
po.Format = imageTypeJPEG
}
} else if po.EnforceWebP && vipsTypeSupportSave[imageTypeWEBP] {
po.Format = imageTypeWEBP
}
if !vipsSupportSmartcrop {