From 2a0823ecbaeb3a6fbedc5cc31879d68fdf27d0cb Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Mon, 9 Mar 2020 13:08:53 +0100 Subject: [PATCH] Support creating variants of `webp` images out of the box This PR adds `image/webp` to the default array of variable content types. Without this commit if we want to "handle" webp images overwriting `config.active_storage.variable_content_types` was necessary. --- activestorage/CHANGELOG.md | 4 ++++ activestorage/lib/active_storage/engine.rb | 1 + guides/source/configuring.md | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/activestorage/CHANGELOG.md b/activestorage/CHANGELOG.md index f008f783e3..40d5a2faee 100644 --- a/activestorage/CHANGELOG.md +++ b/activestorage/CHANGELOG.md @@ -1,3 +1,7 @@ +* Add support for creating variants of `WebP` images out of the box. + + *Dino Maric* + * Only enqueue analysis jobs for blobs with non-null analyzer classes. *Gannon McGibbon* diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb index 735e08e390..f2bbc5a635 100644 --- a/activestorage/lib/active_storage/engine.rb +++ b/activestorage/lib/active_storage/engine.rb @@ -38,6 +38,7 @@ module ActiveStorage image/bmp image/vnd.adobe.photoshop image/vnd.microsoft.icon + image/webp ) config.active_storage.content_types_to_serve_as_binary = %w( diff --git a/guides/source/configuring.md b/guides/source/configuring.md index 29d5559343..7d00377ff1 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -900,7 +900,7 @@ You can find more detailed configuration options in the config.active_storage.paths[:ffprobe] = '/usr/local/bin/ffprobe' ``` -* `config.active_storage.variable_content_types` accepts an array of strings indicating the content types that Active Storage can transform through ImageMagick. The default is `%w(image/png image/gif image/jpg image/jpeg image/pjpeg image/tiff image/bmp image/vnd.adobe.photoshop image/vnd.microsoft.icon)`. +* `config.active_storage.variable_content_types` accepts an array of strings indicating the content types that Active Storage can transform through ImageMagick. The default is `%w(image/png image/gif image/jpg image/jpeg image/pjpeg image/tiff image/bmp image/vnd.adobe.photoshop image/vnd.microsoft.icon image/webp)`. * `config.active_storage.content_types_to_serve_as_binary` accepts an array of strings indicating the content types that Active Storage will always serve as an attachment, rather than inline. The default is `%w(text/html text/javascript image/svg+xml application/postscript application/x-shockwave-flash text/xml application/xml application/xhtml+xml application/mathml+xml text/cache-manifest)`.