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

Fix lint errors

This commit is contained in:
DarthSim 2019-06-08 00:27:34 +06:00
parent b2c5e9c4ab
commit e5e3736d29

View File

@ -154,24 +154,24 @@ func cropImage(img *vipsImage, cropWidth, cropHeight int, gravity *gravityOption
cropHeight = minInt(cropHeight, imgHeight)
}
if cropWidth < imgWidth || cropHeight < imgHeight {
if gravity.Type == gravitySmart {
if err := img.CopyMemory(); err != nil {
return err
}
if err := img.SmartCrop(cropWidth, cropHeight); err != nil {
return err
}
// Applying additional modifications after smart crop causes SIGSEGV on Alpine
// so we have to copy memory after it
return img.CopyMemory()
} else {
left, top := calcCrop(imgWidth, imgHeight, cropWidth, cropHeight, gravity)
return img.Crop(left, top, cropWidth, cropHeight)
}
if cropWidth >= imgWidth && cropHeight >= imgHeight {
return nil
}
return nil
if gravity.Type == gravitySmart {
if err := img.CopyMemory(); err != nil {
return err
}
if err := img.SmartCrop(cropWidth, cropHeight); err != nil {
return err
}
// Applying additional modifications after smart crop causes SIGSEGV on Alpine
// so we have to copy memory after it
return img.CopyMemory()
}
left, top := calcCrop(imgWidth, imgHeight, cropWidth, cropHeight, gravity)
return img.Crop(left, top, cropWidth, cropHeight)
}
func transformImage(ctx context.Context, img *vipsImage, data []byte, po *processingOptions, imgtype imageType) error {