diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-09-28 14:04:43 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-09-29 13:07:08 +0200 |
commit | a40a2b0d64299bc2114c2700a32014110826205f (patch) | |
tree | 5401ea2fe107189df75bf709a7344ba160786f1f | |
parent | 222a4bd4ac7c3d0ce76564a3f0cad9237d121b87 (diff) | |
download | nextcloud-server-a40a2b0d64299bc2114c2700a32014110826205f.tar.gz nextcloud-server-a40a2b0d64299bc2114c2700a32014110826205f.zip |
improve handling of small images
-rw-r--r-- | apps/files/js/mainfileinfodetailview.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index 7f2528737d5..a74534e68e7 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -148,6 +148,10 @@ return img.width > (img.height * 1.2); }; + var isSmall = function(img) { + return (img.width * 1.1) < (maxImageWidth * window.devicePixelRatio); + }; + var getTargetHeight = function(img) { if(isImage) { var targetHeight = img.height / window.devicePixelRatio; @@ -178,7 +182,7 @@ $iconDiv.removeClass('icon-loading icon-32'); var targetHeight = getTargetHeight(img); if (this.model.isImage() && targetHeight > smallPreviewSize) { - $container.addClass(isLandscape(img)? 'landscape': 'portrait'); + $container.addClass((isLandscape(img) && !isSmall(img))? 'landscape': 'portrait'); $container.addClass('image'); } @@ -186,7 +190,8 @@ // when we dont have a preview we show the mime icon in the error handler $iconDiv.css({ 'background-image': 'url("' + previewUrl + '")', - height: (targetHeight > smallPreviewSize)? 'auto': targetHeight + height: (targetHeight > smallPreviewSize)? 'auto': targetHeight, + 'max-height': isSmall(img)? targetHeight: null }); }.bind(this), error: function () { |