forked from mirrors/gotosocial
[bugfix] Check orientation when reading width/height of images (#749)
This commit is contained in:
parent
2462c5fe22
commit
9a9702c964
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue