Do not call resize_image_to_height on smaller images
This commit is contained in:
1 parent
3207f85e08
commit
c20990fca3
1 file changed
+1
@@ -501,6 +501,7 @@ def download_media_thumbnail(media_id, url):
|
|||||||
width = getattr(settings, 'MEDIA_THUMBNAIL_WIDTH', 430)
|
width = getattr(settings, 'MEDIA_THUMBNAIL_WIDTH', 430)
|
||||||
height = getattr(settings, 'MEDIA_THUMBNAIL_HEIGHT', 240)
|
height = getattr(settings, 'MEDIA_THUMBNAIL_HEIGHT', 240)
|
||||||
i = get_remote_image(url)
|
i = get_remote_image(url)
|
||||||
|
if (i.width > width) and (i.height > height):
|
||||||
log.info(f'Resizing {i.width}x{i.height} thumbnail to '
|
log.info(f'Resizing {i.width}x{i.height} thumbnail to '
|
||||||
f'{width}x{height}: {url}')
|
f'{width}x{height}: {url}')
|
||||||
i = resize_image_to_height(i, width, height)
|
i = resize_image_to_height(i, width, height)
|
||||||
|
|||||||
Reference in new issue
Block a user