summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-02-27 09:51:52 +0000
committerGitHub <noreply@github.com>2017-02-27 09:51:52 +0000
commitacf6d4d2e3bfb5a9661f6d56ad94fced2ed7f21a (patch)
tree850658f5f0afdac00451ab6813f6feeabdb50a7d
parentMerge pull request #1939 from matrix-org/erikj/strip_sql_newlines (diff)
parentFix dynamic thumbnails aspect (diff)
downloadsynapse-acf6d4d2e3bfb5a9661f6d56ad94fced2ed7f21a.tar.xz
Merge pull request #1945 from jkolo/fix_dynamic_thumbnails_aspect
Fix #1677 (dynamic thumbnails aspect)
-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