Set thumbnail size and mimetype

This commit is contained in:
Alex Ling 2020-10-29 04:06:44 +00:00
parent 54eb041fe4
commit 18834ac28e
1 changed files with 5 additions and 0 deletions

View File

@ -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 " \