From 657c51ff162d051cd5dd0fd7f353f546f634c2b9 Mon Sep 17 00:00:00 2001 From: Breno Gazzola Date: Wed, 4 Aug 2021 13:03:27 -0300 Subject: [PATCH] Document Active Storage implicit transformations --- guides/source/active_storage_overview.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md index bc74c693d5d..015b28e3cbc 100644 --- a/guides/source/active_storage_overview.md +++ b/guides/source/active_storage_overview.md @@ -850,6 +850,12 @@ location. <%= image_tag user.avatar.variant(resize_to_limit: [100, 100]) %> ``` +If a variant is requested, Active Storage will automatically apply +transformations depending on the image's format: + +1. Content types that are `variable` and not considered [`web images`], will be converted to PNG. +2. If `quality` is not specified, the variant processor's default quality for the format will be used. + The default processor for Active Storage is MiniMagick, but you can also use [Vips][]. To switch to Vips, add the following to `config/application.rb`: @@ -870,6 +876,8 @@ specific: ``` [`variant`]: https://api.rubyonrails.org/classes/ActiveStorage/Blob/Representable.html#method-i-variant +[`web images`]: https://github.com/rails/rails/blob/main/activestorage/lib/active_storage/engine.rb#L47 +[`variable`]: https://github.com/rails/rails/blob/main/activestorage/lib/active_storage/engine.rb#L34 [Vips]: https://www.rubydoc.info/gems/ruby-vips/Vips/Image ### Previewing Files