summaryrefslogtreecommitdiffstats
path: root/app/file.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2018-05-04 01:02:22 +0800
committerGitHub <noreply@github.com>2018-05-04 01:02:22 +0800
commit5000eac24f8d9aeef9cd24a58af43597e6c62b02 (patch)
treead3e41ea88a3b442eedbef6aff01abcedff5b610 /app/file.go
parent14b65b990c7f67b66c3188b4120bf27fb1f24a2d (diff)
downloadchat-5000eac24f8d9aeef9cd24a58af43597e6c62b02.tar.gz
chat-5000eac24f8d9aeef9cd24a58af43597e6c62b02.tar.bz2
chat-5000eac24f8d9aeef9cd24a58af43597e6c62b02.zip
respect image orientation before saving height and width of FileInfo (#8710)
Diffstat (limited to 'app/file.go')
-rw-r--r--app/file.go8
1 files changed, 8 insertions, 0 deletions
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