Support additional image formats:

- APNG
- AVIF
- GIF
- SVG
This commit is contained in:
Alex Ling 2021-09-07 11:04:05 +00:00
parent d9adb49c27
commit 371796cce9
2 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,12 @@
SUPPORTED_IMG_TYPES = ["image/jpeg", "image/png", "image/webp"] SUPPORTED_IMG_TYPES = %w(
image/jpeg
image/png
image/webp
image/apng
image/avif
image/gif
image/svg+xml
)
enum SortMethod enum SortMethod
Auto Auto

View File

@ -35,6 +35,11 @@ def register_mime_types
# FontAwesome fonts # FontAwesome fonts
".woff" => "font/woff", ".woff" => "font/woff",
".woff2" => "font/woff2", ".woff2" => "font/woff2",
# Supported image formats. JPG, PNG, GIF, WebP, and SVG are already
# defiend by Crystal in `MIME.DEFAULT_TYPES`
".apng" => "image/apng",
".avif" => "image/avif",
}.each do |k, v| }.each do |k, v|
MIME.register k, v MIME.register k, v
end end