Verified Commit a2af8995 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Fix thumbnailing of images to same size as source

parent 44979b0b
......@@ -87,6 +87,10 @@ def generate_thumbnail(request, request_path):
if not sig_info['fit']:
ratio = min([a / b for a, b in zip(size, image.size)])
size = tuple(int(ratio * x) for x in image.size)
if size[0] == image.size[0] and size[1] == image.size[1]:
image.save(full_thumb_path)
else:
thumb = ImageOps.fit(image, size, Image.ANTIALIAS)
thumb.save(full_thumb_path)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment