summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorJurek <jurek@kolosowscy.pl>2017-02-24 22:42:38 +0100
committerJurek <jurek@kolosowscy.pl>2017-02-24 22:43:27 +0100
commitaea546148879f7e376c626346eb789308d089249 (patch)
treed4d6ad3d619af3d0ae14d5db0006e28293aa35a6 /synapse/rest
parentMerge pull request #1810 from matrix-org/erikj/state_auth_splitout_split (diff)
downloadsynapse-aea546148879f7e376c626346eb789308d089249.tar.xz
Fix dynamic thumbnails aspect
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/media/v1/media_repository.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/rest/media/v1/media_repository.py b/synapse/rest/media/v1/media_repository.py
index 3cbeca503c..481ffee200 100644
--- a/synapse/rest/media/v1/media_repository.py
+++ b/synapse/rest/media/v1/media_repository.py
@@ -240,6 +240,9 @@ class MediaRepository(object):
         if t_method == "crop":
             t_len = thumbnailer.crop(t_path, t_width, t_height, t_type)
         elif t_method == "scale":
+            t_width, t_height = thumbnailer.aspect(t_width, t_height)
+            t_width = min(m_width, t_width)
+            t_height = min(m_height, t_height)
             t_len = thumbnailer.scale(t_path, t_width, t_height, t_type)
         else:
             t_len = None