mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #42926 from FestaLab/activestorage/implicit-transformations
Document Active Storage implicit transformations [ci-skip]
This commit is contained in:
commit
7f5ebc4b43
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue