Skip to content

Commit

Permalink
crop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jul 18, 2024
1 parent 54a4817 commit e95be4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/context/context.utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ func resizeImage(fileHeader *multipart.FileHeader, newWidth, newHeight int) (ima
if format == "image/jpeg" || format == "image/jpg" {
croppedImg = img.(*image.YCbCr).SubImage(cropRect)
} else if format == "image/png" {
switch img.(type) { //nolint:staticcheck // S1034 ignore this!
switch img := img.(type) {
case *image.RGBA:
croppedImg = img.(*image.RGBA).SubImage(cropRect)
croppedImg = img.SubImage(cropRect)
case *image.NRGBA:
croppedImg = img.(*image.NRGBA).SubImage(cropRect)
croppedImg = img.SubImage(cropRect)
default:
return nil, fmt.Errorf("unsupported image type: %T", img)
}
Expand Down

0 comments on commit e95be4c

Please sign in to comment.