mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-11 04:32:29 +02:00
IMGPROXY_ENFORCE_THUMBNAIL config & enforce_thumbnail option
This commit is contained in:
@@ -239,8 +239,14 @@ func ProcessImage(ctx context.Context, imgdata *imagedata.ImageData, po *options
|
||||
img := new(vips.Image)
|
||||
defer img.Clear()
|
||||
|
||||
if err := img.Load(imgdata, 1, 1.0, pages); err != nil {
|
||||
return nil, err
|
||||
if po.EnforceThumbnail && imgdata.Type.SupportsThumbnail() {
|
||||
if err := img.LoadThumbnail(imgdata); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
if err := img.Load(imgdata, 1, 1.0, pages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
originWidth, originHeight := getImageSize(img)
|
||||
|
Reference in New Issue
Block a user