From 18834ac28e2742e02ef0b13ecb66794bd615598a Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Thu, 29 Oct 2020 04:06:44 +0000 Subject: [PATCH] Set thumbnail size and mimetype --- src/library/entry.cr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/library/entry.cr b/src/library/entry.cr index b96681e..796d983 100644 --- a/src/library/entry.cr +++ b/src/library/entry.cr @@ -220,6 +220,11 @@ class Entry thumbnail = ImageSize.resize img.data, height: 300 end img.data = thumbnail + img.size = thumbnail.size + unless img.mime == "image/webp" + # image_size.cr resizes non-webp images to jpg + img.mime = "image/jpeg" + end Storage.default.save_thumbnail @id, img rescue e Logger.warn "Failed to generate thumbnail for entry " \