mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-26 04:02:12 +00:00
[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 {
|
||||
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