commit 9a9702c9641e1488e69f07e1cb6b1af31410a3dc
parent 2462c5fe224ee57d13f8e9cecb26e674df0f7985
Author: tobi <31960611+tsmethurst@users.noreply.github.com>
Date: Wed, 10 Aug 2022 15:54:15 +0200
[bugfix] Check orientation when reading width/height of images (#749)
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/internal/media/image.go b/internal/media/image.go
@@ -72,9 +72,12 @@ func decodeImage(r io.Reader, contentType string) (*imageMeta, error) {
switch contentType {
case mimeImageJpeg:
- i, err = jpeg.Decode(r)
+ i, err = imaging.Decode(r, imaging.AutoOrientation(true))
case mimeImagePng:
- i, err = StrippedPngDecode(r)
+ strippedPngReader := io.Reader(&PNGAncillaryChunkStripper{
+ Reader: r,
+ })
+ i, err = imaging.Decode(strippedPngReader, imaging.AutoOrientation(true))
default:
err = fmt.Errorf("content type %s not recognised", contentType)
}