summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-08-02 08:58:33 -0800
committerCorey Hulen <corey@hulen.com>2015-08-02 08:58:33 -0800
commit41f96636d6a92f622518271f9ea7dd66c8c84e47 (patch)
treeb9462b5385b505a0220a1df47e5efe64fd2d84d0 /web/react/components
parent810c527fcbf5a9b4e32fe94e3ea00e20bddc020a (diff)
parentdad78514234029791ff02c9a0efd2cbacdac5280 (diff)
downloadchat-41f96636d6a92f622518271f9ea7dd66c8c84e47.tar.gz
chat-41f96636d6a92f622518271f9ea7dd66c8c84e47.tar.bz2
chat-41f96636d6a92f622518271f9ea7dd66c8c84e47.zip
Merge pull request #274 from mattermost/mm-1497
MM-1497 image thumbnails now scale appropriately so there is no whitespace
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/file_attachment.jsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx
index 3cd791887..b7ea5734f 100644
--- a/web/react/components/file_attachment.jsx
+++ b/web/react/components/file_attachment.jsx
@@ -2,6 +2,7 @@
// See License.txt for license information.
var utils = require('../utils/utils.jsx');
+var Constants = require('../utils/constants.jsx');
module.exports = React.createClass({
displayName: "FileAttachment",
@@ -44,6 +45,16 @@ module.exports = React.createClass({
$(imgDiv).removeClass('post__load');
$(imgDiv).addClass('post__image');
+ var width = this.width || $(this).width();
+ var height = this.height || $(this).height();
+
+ if (width < Constants.THUMBNAIL_WIDTH
+ && height < Constants.THUMBNAIL_HEIGHT) {
+ $(imgDiv).addClass('small');
+ } else {
+ $(imgDiv).addClass('normal');
+ }
+
var re1 = new RegExp(' ', 'g');
var re2 = new RegExp('\\(', 'g');
var re3 = new RegExp('\\)', 'g');