mirror of
1
Fork 0

[bugfix] Check orientation when reading width/height of images (#749)

This commit is contained in:
tobi 2022-08-10 15:54:15 +02:00 committed by GitHub
parent 2462c5fe22
commit 9a9702c964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -72,9 +72,12 @@ func decodeImage(r io.Reader, contentType string) (*imageMeta, error) {
switch contentType { switch contentType {
case mimeImageJpeg: case mimeImageJpeg:
i, err = jpeg.Decode(r) i, err = imaging.Decode(r, imaging.AutoOrientation(true))
case mimeImagePng: case mimeImagePng:
i, err = StrippedPngDecode(r) strippedPngReader := io.Reader(&PNGAncillaryChunkStripper{
Reader: r,
})
i, err = imaging.Decode(strippedPngReader, imaging.AutoOrientation(true))
default: default:
err = fmt.Errorf("content type %s not recognised", contentType) err = fmt.Errorf("content type %s not recognised", contentType)
} }