From 998b8f70c2d88151b080657dea1ce0b9aca36d58 Mon Sep 17 00:00:00 2001
From: Rich Barton <emptyarray@users.noreply.github.com>
Date: Mon, 10 Jul 2017 06:51:07 -0700
Subject: PLT-6659 Fixed upload thumbnails that weren't properly rotated
 (#6816)

- Used client-side EXIF data to rotate profile picture thumbnails
- Added a small package for correctly translating EXIF orientation into CSS transforms
- Instead of displaying the image using FileReader, used URL.createObjectURL because it is faster
- For upload thumbnails, the original behavior was scaling the entire original image, without accounting for EXIF rotate. I changed this to use the thumbnail image, which does respect rotation.
- The preview image was not available when the upload request returned, because handling the preview image creation was in a goroutine. I used sync.WaitGroup to block until the preview image creation is done.
---
 webapp/components/file_preview.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'webapp/components/file_preview.jsx')

diff --git a/webapp/components/file_preview.jsx b/webapp/components/file_preview.jsx
index 65a71c047..0606c1b31 100644
--- a/webapp/components/file_preview.jsx
+++ b/webapp/components/file_preview.jsx
@@ -3,7 +3,7 @@
 
 import ReactDOM from 'react-dom';
 import * as Utils from 'utils/utils.jsx';
-import {getFileUrl} from 'mattermost-redux/utils/file_utils';
+import {getFileThumbnailUrl} from 'mattermost-redux/utils/file_utils';
 
 import PropTypes from 'prop-types';
 
@@ -39,7 +39,7 @@ export default class FilePreview extends React.Component {
                 previewImage = (
                     <img
                         className='file-preview__image'
-                        src={getFileUrl(info.id)}
+                        src={getFileThumbnailUrl(info.id)}
                     />
                 );
             } else {
-- 
cgit v1.2.3-1-g7c22

