about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/javascript/mastodon/components/media_gallery.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js
index 3568a8440..71436500a 100644
--- a/app/javascript/mastodon/components/media_gallery.js
+++ b/app/javascript/mastodon/components/media_gallery.js
@@ -167,6 +167,14 @@ class Item extends React.PureComponent {
           vShift = shiftToPoint(widthRatio, (containerHeight * (height / 100)), originalHeight, focusY, true);
         }
 
+        if (originalWidth > originalHeight) {
+          imageStyle.height = '100%';
+          imageStyle.width  = 'auto';
+        } else {
+          imageStyle.height = 'auto';
+          imageStyle.width  = '100%';
+        }
+
         imageStyle.top  = vShift;
         imageStyle.left = hShift;
       } else {