[bugfix] Check orientation when reading width/height of images (#749)
This commit is contained in:
parent
2462c5fe22
commit
9a9702c964
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue