From 5000eac24f8d9aeef9cd24a58af43597e6c62b02 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Fri, 4 May 2018 01:02:22 +0800 Subject: respect image orientation before saving height and width of FileInfo (#8710) --- app/file.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/file.go') diff --git a/app/file.go b/app/file.go index a1addd7ac..96d1caabd 100644 --- a/app/file.go +++ b/app/file.go @@ -361,6 +361,14 @@ func (a *App) DoUploadFile(now time.Time, rawTeamId string, rawChannelId string, return nil, err } + if orientation, err := getImageOrientation(bytes.NewReader(data)); err == nil && + (orientation == RotatedCWMirrored || + orientation == RotatedCCW || + orientation == RotatedCCWMirrored || + orientation == RotatedCW) { + info.Width, info.Height = info.Height, info.Width + } + info.Id = model.NewId() info.CreatorId = userId -- cgit v1.2.3-1-g7c22