diff options
author | Mark Haines <mjark@negativecurvature.net> | 2015-07-23 11:16:02 +0100 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2015-07-23 11:16:02 +0100 |
commit | 6886bba9889468d1839a45f20c1bce476e62e87c (patch) | |
tree | 69518b2498d8adf437100e6d3ad17a68e1b9689b /synapse/rest | |
parent | Disable receipts for now (diff) | |
parent | Pick larger than desired thumbnail for 'crop' (diff) | |
download | synapse-6886bba9889468d1839a45f20c1bce476e62e87c.tar.xz |
Merge pull request #205 from matrix-org/erikj/pick_largest_thumbnail
Pick larger than desired thumbnail for 'crop'
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/media/v1/thumbnail_resource.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/thumbnail_resource.py b/synapse/rest/media/v1/thumbnail_resource.py index 4a9b6d8eeb..61f88e486e 100644 --- a/synapse/rest/media/v1/thumbnail_resource.py +++ b/synapse/rest/media/v1/thumbnail_resource.py @@ -162,11 +162,12 @@ class ThumbnailResource(BaseMediaResource): t_method = info["thumbnail_method"] if t_method == "scale" or t_method == "crop": aspect_quality = abs(d_w * t_h - d_h * t_w) + min_quality = 0 if d_w <= t_w and d_h <= t_h else 1 size_quality = abs((d_w - t_w) * (d_h - t_h)) type_quality = desired_type != info["thumbnail_type"] length_quality = info["thumbnail_length"] info_list.append(( - aspect_quality, size_quality, type_quality, + aspect_quality, min_quality, size_quality, type_quality, length_quality, info )) if info_list: |