Merge pull request #42482 from FestaLab/activestorage-documentation

Explain differences between active storage variant processors [skip ci]
This commit is contained in:
Zachary Scott 2021-06-15 09:12:02 +09:00 committed by GitHub
commit e581678396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -713,6 +713,18 @@ The default processor for Active Storage is MiniMagick, but you can also use
config.active_storage.variant_processor = :vips
```
The two processors are not fully compatible, so when migrating an existing application
using MiniMagick to Vips, some changes have to be made if using options that are format
specific:
```rhtml
<!-- MiniMagick -->
<%= image_tag user.avatar.variant(resize_to_limit: [100, 100], format: :jpeg, sampling_factor: "4:2:0", strip: true, interlace: "JPEG", colorspace: "sRGB", quality: 80) %>
<!-- Vips -->
<%= image_tag user.avatar.variant(resize_to_limit: [100, 100], format: :jpeg, saver: { subsample_mode: "on", strip: true, interlace: true, quality: 80 }) %>
```
[`variant`]: https://api.rubyonrails.org/classes/ActiveStorage/Blob/Representable.html#method-i-variant
[Vips]: https://www.rubydoc.info/gems/ruby-vips/Vips/Image