Skip to content

Commit 9826d74

Browse files
authored
Merge pull request rails#51759 from trebeil/patch-1
Update active_storage_overview.md [ci skip]
2 parents 7c1db0d + 1b3f4a2 commit 9826d74

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

guides/source/active_storage_overview.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -974,18 +974,6 @@ Active Storage can use either [Vips][] or MiniMagick as the variant processor.
974974
The default depends on your `config.load_defaults` target version, and the
975975
processor can be changed by setting [`config.active_storage.variant_processor`][].
976976

977-
The two processors are not fully compatible, so when migrating an existing application
978-
between MiniMagick and Vips, some changes have to be made if using options that are format
979-
specific:
980-
981-
```erb
982-
<!-- MiniMagick -->
983-
<%= 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) %>
984-
985-
<!-- Vips -->
986-
<%= image_tag user.avatar.variant(resize_to_limit: [100, 100], format: :jpeg, saver: { subsample_mode: "on", strip: true, interlace: true, quality: 80 }) %>
987-
```
988-
989977
The parameters available are defined by the [`image_processing`][] gem and depend on the
990978
variant processor that you are using, but both support the following parameters:
991979

@@ -998,8 +986,30 @@ variant processor that you are using, but both support the following parameters:
998986
| `crop` | `crop: [20, 50, 300, 300]` | Extracts an area from an image. The first two arguments are the left and top edges of area to extract, while the last two arguments are the width and height of the area to extract. |
999987
| `rotate` | `rotate: 90` | Rotates the image by the specified angle. |
1000988

1001-
[`image_processing`][] has more options available (such as `saver` which allows image compression to be configured) in it's own documentation for the [Vips](https://github.com/janko/image_processing/blob/master/doc/vips.md) and [MiniMagick](https://github.com/janko/image_processing/blob/master/doc/minimagick.md) processors.
989+
[`image_processing`][] has all parameters available in it's own documentation
990+
for both the
991+
[Vips](https://github.com/janko/image_processing/blob/master/doc/vips.md) and
992+
[MiniMagick](https://github.com/janko/image_processing/blob/master/doc/minimagick.md)
993+
processors.
1002994

995+
Some parameters, including those listed above, accept additional processor
996+
specific options which can be passed as `key: value` pairs inside a hash:
997+
998+
```erb
999+
<!-- Vips supports configuring `crop` for many of its transformations -->
1000+
<%= image_tag user.avatar.variant(resize_to_fill: [100, 100, { crop: :centre }]) %>
1001+
```
1002+
1003+
If migrating an existing application between MiniMagick and Vips, processor
1004+
specific options will need to be updated:
1005+
1006+
```erb
1007+
<!-- MiniMagick -->
1008+
<%= 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) %>
1009+
1010+
<!-- Vips -->
1011+
<%= image_tag user.avatar.variant(resize_to_limit: [100, 100], format: :jpeg, saver: { subsample_mode: "on", strip: true, interlace: true, quality: 80 }) %>
1012+
```
10031013

10041014
[`config.active_storage.variable_content_types`]: configuring.html#config-active-storage-variable-content-types
10051015
[`config.active_storage.variant_processor`]: configuring.html#config-active-storage-variant-processor

0 commit comments

Comments
 (0)