faster image resizing and smaller results

This commit is contained in:
thomas girod
2024-10-02 23:15:37 +02:00
parent 655d72a2b1
commit d0f17bd41a
2 changed files with 32 additions and 21 deletions

View File

@ -117,7 +117,11 @@ class Picture(SasFile):
# meant to be shown on the website, but rather to keep the real image
# for less frequent cases (like downloading the pictures of an user)
extension = self.mime_type.split("/")[-1]
file = resize_image(im, max(im.size), extension)
# the HD version of the image doesn't need to be optimized, because :
# - it isn't frequently queried
# - optimizing large images takes a lot time, which greatly hinders the UX
# - photographers usually already optimize their images
file = resize_image(im, max(im.size), extension, optimize=False)
thumb = resize_image(im, 200, "webp")
compressed = resize_image(im, 1200, "webp")
if overwrite: