1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-12-11 23:48:13 +02:00

Don't combine crops

This commit is contained in:
DarthSim
2020-01-15 18:25:14 +06:00
parent 4030f17307
commit 1cd9a92582

View File

@@ -398,26 +398,11 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces
dprWidth := scaleInt(po.Width, po.Dpr)
dprHeight := scaleInt(po.Height, po.Dpr)
if cropGravity.Type == po.Gravity.Type && cropGravity.Type != gravityFocusPoint {
cropWidth = minNonZeroInt(cropWidth, dprWidth)
cropHeight = minNonZeroInt(cropHeight, dprHeight)
sumGravity := gravityOptions{
Type: cropGravity.Type,
X: cropGravity.X + po.Gravity.X,
Y: cropGravity.Y + po.Gravity.Y,
}
if err = cropImage(img, cropWidth, cropHeight, &sumGravity); err != nil {
return err
}
} else {
if err = cropImage(img, cropWidth, cropHeight, &cropGravity); err != nil {
return err
}
if err = cropImage(img, dprWidth, dprHeight, &po.Gravity); err != nil {
return err
}
if err = cropImage(img, cropWidth, cropHeight, &cropGravity); err != nil {
return err
}
if err = cropImage(img, dprWidth, dprHeight, &po.Gravity); err != nil {
return err
}
checkTimeout(ctx)