mirror of https://github.com/rails/rails
Remove deprecated support to pass `:combine_options` operations to `ActiveStorage::Transformers::ImageProcessing`
This commit is contained in:
parent
bad3d0f6a3
commit
62bda903be
|
@ -1,3 +1,7 @@
|
|||
* Remove deprecated support to pass `:combine_options` operations to `ActiveStorage::Transformers::ImageProcessing`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Remove deprecated `ActiveStorage::Transformers::MiniMagickTransformer`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
|
|
@ -29,14 +29,13 @@ module ActiveStorage
|
|||
def operations
|
||||
transformations.each_with_object([]) do |(name, argument), list|
|
||||
if name.to_s == "combine_options"
|
||||
ActiveSupport::Deprecation.warn <<~WARNING.squish
|
||||
raise ArgumentError, <<~ERROR.squish
|
||||
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.
|
||||
WARNING
|
||||
as it always generates a single ImageMagick command.
|
||||
ERROR
|
||||
end
|
||||
|
||||
list.concat argument.keep_if { |key, value| value.present? }.to_a
|
||||
elsif argument.present?
|
||||
if argument.present?
|
||||
list << [ name, argument ]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -60,52 +60,14 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
|
|||
assert_match(/RGB/, image.colorspace)
|
||||
end
|
||||
|
||||
test "disabled variation of JPEG blob with :combine_options" do
|
||||
test "variation with :combine_options is not supported" do
|
||||
blob = create_file_blob(filename: "racecar.jpg")
|
||||
variant = ActiveSupport::Deprecation.silence do
|
||||
assert_raises(ArgumentError) do
|
||||
blob.variant(combine_options: {
|
||||
resize: "100x100",
|
||||
monochrome: false
|
||||
}).processed
|
||||
end
|
||||
assert_match(/racecar\.jpg/, variant.url)
|
||||
|
||||
image = read_image(variant)
|
||||
assert_equal 100, image.width
|
||||
assert_equal 67, image.height
|
||||
assert_match(/RGB/, image.colorspace)
|
||||
end
|
||||
|
||||
test "disabled variation using :combine_options" do
|
||||
blob = create_file_blob(filename: "racecar.jpg")
|
||||
variant = ActiveSupport::Deprecation.silence do
|
||||
blob.variant(combine_options: {
|
||||
crop: "100x100+0+0",
|
||||
monochrome: false
|
||||
}).processed
|
||||
end
|
||||
assert_match(/racecar\.jpg/, variant.url)
|
||||
|
||||
image = read_image(variant)
|
||||
assert_equal 100, image.width
|
||||
assert_equal 100, image.height
|
||||
assert_match(/RGB/, image.colorspace)
|
||||
end
|
||||
|
||||
test "center-weighted crop of JPEG blob using :combine_options" do
|
||||
blob = create_file_blob(filename: "racecar.jpg")
|
||||
variant = ActiveSupport::Deprecation.silence do
|
||||
blob.variant(combine_options: {
|
||||
gravity: "center",
|
||||
resize: "100x100^",
|
||||
crop: "100x100+0+0",
|
||||
}).processed
|
||||
end
|
||||
assert_match(/racecar\.jpg/, variant.url)
|
||||
|
||||
image = read_image(variant)
|
||||
assert_equal 100, image.width
|
||||
assert_equal 100, image.height
|
||||
end
|
||||
|
||||
test "center-weighted crop of JPEG blob using :resize_to_fill" do
|
||||
|
|
|
@ -243,6 +243,8 @@ Please refer to the [Changelog][active-storage] for detailed changes.
|
|||
|
||||
### Removals
|
||||
|
||||
* Remove deprecated support to pass `:combine_options` operations to `ActiveStorage::Transformers::ImageProcessing`.
|
||||
|
||||
* Remove deprecated `ActiveStorage::Transformers::MiniMagickTransformer`.
|
||||
|
||||
* Remove deprecated `config.active_storage.queue`.
|
||||
|
|
Loading…
Reference in New Issue