feat: add file types whitelist for image processing (#885)
Add `allowedTypes` and `resizableTypes` to `imageProcessing` configuration Prior to this commit, SVG images were not processed by `render-image.html` because SVG does not have a physical dimension like JPEG. This logic was done using a conditional. I have now realised that Hugo can be very slow when resizing `gif` images. So I created this whitelist mechanism: - `allowedTypes`: image types with width and height attributes - `resizableTypes`: image types that can be resized Here's a list of media types: bmp, gif, jpeg, png, svg+xml, tiff, webp https://gohugo.io/templates/output-formats/#media-types
This commit is contained in:
@@ -11,7 +11,7 @@ featuredImageField: image
|
||||
rssFullContent: true
|
||||
|
||||
# Path to favicon, relative to assets folder
|
||||
favicon:
|
||||
favicon:
|
||||
|
||||
footer:
|
||||
# Year when site was first published
|
||||
@@ -146,6 +146,15 @@ colorScheme:
|
||||
default: auto
|
||||
|
||||
imageProcessing:
|
||||
allowedTypes:
|
||||
- jpeg
|
||||
- png
|
||||
- gif
|
||||
- webp
|
||||
resizableTypes:
|
||||
- jpeg
|
||||
- png
|
||||
- webp
|
||||
cover:
|
||||
enabled: true
|
||||
content:
|
||||
|
||||
Reference in New Issue
Block a user