mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 13:38:16 -08:00
Mod, fix autoRotate not clearing orientation exif data
This commit is contained in:
parent
44c1dfbd7e
commit
d9221924d2
2 changed files with 17 additions and 7 deletions
3
go.mod
Normal file
3
go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
module github.com/gosuimg/bimg
|
||||||
|
|
||||||
|
go 1.20
|
||||||
21
resizer.go
21
resizer.go
|
|
@ -45,19 +45,26 @@ func resizer(buf []byte, o Options) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto rotate image based on EXIF orientation header
|
// Auto rotate image based on EXIF orientation header
|
||||||
image, rotated, err := rotateAndFlipImage(image, o)
|
// image, rotated, err := rotateAndFlipImage(image, o)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, err
|
// return nil, err
|
||||||
}
|
// }
|
||||||
|
|
||||||
// If JPEG or HEIF image, retrieve the buffer
|
if (imageType == JPEG || imageType == HEIF || imageType == AVIF) && !o.NoAutoRotate {
|
||||||
if rotated && (imageType == JPEG || imageType == HEIF || imageType == AVIF) && !o.NoAutoRotate {
|
image, err = vipsAutoRotate(image)
|
||||||
buf, err = getImageBuffer(image)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If JPEG or HEIF image, retrieve the buffer
|
||||||
|
// if rotated && (imageType == JPEG || imageType == HEIF || imageType == AVIF) && !o.NoAutoRotate {
|
||||||
|
// buf, err = getImageBuffer(image)
|
||||||
|
// if err != nil {
|
||||||
|
// return nil, err
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
inWidth := int(image.Xsize)
|
inWidth := int(image.Xsize)
|
||||||
inHeight := int(image.Ysize)
|
inHeight := int(image.Ysize)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue