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?
1
  • 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 4, 2020 at 17:32

1 Answer 1

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.

1
  • This generates a new variant hash key right? So any previous image upgraded to this syntax will generate a new image? Mar 30, 2021 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.