6

While developing a new Rails Application, I noticed the following deprecation warning in the console:

DEPRECATION WARNING: Active Storage's ImageProcessing transformer doesn't support :combine_options, as it always generates a single ImageMagick command. Passing :combine_options will not be supported in Rails 6.1.

This is also mentioned in the Rails 6 release notes:

Deprecate :combine_options in Active Storage's ImageProcessing transformer without replacement.

Now I'm wondering:

  • What we are supposed to use in the future to be able to things such as: <%= image_tag @category.image.variant(combine_options: { resize_to_fill: [800,50] }, gaussian_blur: ['0x1.5']), class: "card-img-top" if @category.image.attached? %>
  • What would be the reason for deprecating this functionality?
anothermh
  • 9,815
  • 3
  • 33
  • 52
NL-Kevin
  • 197
  • 10
  • 1
    You're far more likely to get an answer and people are far more likely to discover this post when you spell "deprecation" correctly. – anothermh Jan 04 '20 at 17:32

1 Answers1

10

I should have looked better in the API Documentation.

ActiveStore.Variant takes multiple arguments directly. Taking my example above, the following works and will continue to work:

<%= image_tag @category.image.variant(resize_to_fill: [800,50], gaussian_blur: ['0x1.5']), class: "card-img-top" if @category.image.attached? %>

As a result there's no need to use combine_options.

NL-Kevin
  • 197
  • 10
  • This generates a new variant hash key right? So any previous image upgraded to this syntax will generate a new image? – John Pollard Mar 30 '21 at 14:53