mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 15:01:23 +01:00
Move type into key
This commit is contained in:
parent
ad1911bbf4
commit
31aa7bd8d1
1 changed files with 3 additions and 3 deletions
|
@ -468,15 +468,15 @@ class MediaRepository(object):
|
||||||
thumbnails = {}
|
thumbnails = {}
|
||||||
for r_width, r_height, r_method, r_type in requirements:
|
for r_width, r_height, r_method, r_type in requirements:
|
||||||
if r_method == "crop":
|
if r_method == "crop":
|
||||||
thumbnails.setdefault((r_width, r_height), (r_method, r_type))
|
thumbnails.setdefault((r_width, r_height,r_type), r_method)
|
||||||
elif r_method == "scale":
|
elif r_method == "scale":
|
||||||
t_width, t_height = thumbnailer.aspect(r_width, r_height)
|
t_width, t_height = thumbnailer.aspect(r_width, r_height)
|
||||||
t_width = min(m_width, t_width)
|
t_width = min(m_width, t_width)
|
||||||
t_height = min(m_height, t_height)
|
t_height = min(m_height, t_height)
|
||||||
thumbnails[(t_width, t_height)] = (r_method, r_type)
|
thumbnails[(t_width, t_height, r_type)] = r_method
|
||||||
|
|
||||||
# Now we generate the thumbnails for each dimension, store it
|
# Now we generate the thumbnails for each dimension, store it
|
||||||
for (t_width, t_height), (t_method, t_type) in thumbnails.iteritems():
|
for (t_width, t_height, t_type), t_method in thumbnails.iteritems():
|
||||||
# Generate the thumbnail
|
# Generate the thumbnail
|
||||||
if t_type == "crop":
|
if t_type == "crop":
|
||||||
t_byte_source = yield make_deferred_yieldable(threads.deferToThread(
|
t_byte_source = yield make_deferred_yieldable(threads.deferToThread(
|
||||||
|
|
Loading…
Reference in a new issue