diff options
author | J. Ansorg <[email protected]> | 2019-09-21 16:50:27 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-09-21 16:50:27 +0200 |
commit | e5856e61d88ef5149582851b00e06b5b93dce9f8 (patch) | |
tree | 5cfa1d63c34fbca7c4c226827dc574794edd4ecd /media | |
parent | 34dc06b032741abac342d7a2a77510ded9b72ae8 (diff) | |
download | hugo-e5856e61d88ef5149582851b00e06b5b93dce9f8.tar.gz hugo-e5856e61d88ef5149582851b00e06b5b93dce9f8.zip |
resources: Support output image format in image operations
The image format is defined as the image extension of the known formats,
excluding the dot.
All of 'img.Resize "600x jpeg"', 'img.Resize "600x jpg"',
and 'img.Resize "600x png"' are valid format definitions.
If the target format is defined in the operation definition string,
then the converted image will be stored in this format. Permalinks and
media type are updated correspondingly.
Unknown image extensions in the operation definition have not effect.
See #6298
Diffstat (limited to 'media')
-rw-r--r-- | media/mediaType.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/media/mediaType.go b/media/mediaType.go index 434672c43..baf7b7e27 100644 --- a/media/mediaType.go +++ b/media/mediaType.go @@ -140,8 +140,11 @@ var ( YAMLType = Type{MainType: "application", SubType: "yaml", Suffixes: []string{"yaml", "yml"}, Delimiter: defaultDelimiter} // Common image types - PNGType = Type{MainType: "image", SubType: "png", Suffixes: []string{"png"}, Delimiter: defaultDelimiter} - JPGType = Type{MainType: "image", SubType: "jpg", Suffixes: []string{"jpg", "jpeg"}, Delimiter: defaultDelimiter} + PNGType = Type{MainType: "image", SubType: "png", Suffixes: []string{"png"}, Delimiter: defaultDelimiter} + JPGType = Type{MainType: "image", SubType: "jpg", Suffixes: []string{"jpg", "jpeg"}, Delimiter: defaultDelimiter} + GIFType = Type{MainType: "image", SubType: "gif", Suffixes: []string{"gif"}, Delimiter: defaultDelimiter} + TIFFType = Type{MainType: "image", SubType: "tiff", Suffixes: []string{"tif", "tiff"}, Delimiter: defaultDelimiter} + BMPType = Type{MainType: "image", SubType: "bmp", Suffixes: []string{"bmp"}, Delimiter: defaultDelimiter} OctetType = Type{MainType: "application", SubType: "octet-stream"} ) |