Merge pull request #42926 from FestaLab/activestorage/implicit-transformations

Document Active Storage implicit transformations [ci-skip]
This commit is contained in:
Eileen M. Uchitelle 2021-08-05 15:32:16 -04:00 committed by GitHub
commit 7f5ebc4b43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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