Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deprecation of combine_options in Active Storage's ImageProcessing transformer

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?
like image 903
NL-Kevin Avatar asked Jan 25 '23 11:01

NL-Kevin


1 Answers

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.

like image 149
NL-Kevin Avatar answered Jan 31 '23 08:01

NL-Kevin