From 75eae76db36998a8c1b4f899abccd71b43e7cae8 Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Wed, 25 Oct 2023 11:33:00 -0700 Subject: [PATCH] fix: pass enlarge:true to resize_to_fit/fill This matches image_processing behaviour: https://github.com/janko/image_processing/blob/master/doc/vips.md#resize_to_fit --- lib/imgproxy-rails/transformer.rb | 4 ++-- spec/lib/imgproxy-rails/transformer_spec.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/imgproxy-rails/transformer.rb b/lib/imgproxy-rails/transformer.rb index 50ae51b..90f8e7f 100644 --- a/lib/imgproxy-rails/transformer.rb +++ b/lib/imgproxy-rails/transformer.rb @@ -8,8 +8,8 @@ class Transformer {width: width, height: height} end, resize_to_limit: proc { |p| {width: p[0], height: p[1]} }, - resize_to_fit: proc { |p| {width: p[0], height: p[1]} }, - resize_to_fill: proc { |p| {width: p[0], height: p[1], resizing_type: :fill} }, + resize_to_fit: proc { |p| {width: p[0], height: p[1], enlarge: true} }, + resize_to_fill: proc { |p| {width: p[0], height: p[1], resizing_type: :fill, enlarge: true} }, resize_and_pad: proc { |p, m| resize_and_pad(p, m) }, convert: proc { |p| {format: p} }, trim: proc { {trim: 0} }, diff --git a/spec/lib/imgproxy-rails/transformer_spec.rb b/spec/lib/imgproxy-rails/transformer_spec.rb index 217b20f..6664fb4 100644 --- a/spec/lib/imgproxy-rails/transformer_spec.rb +++ b/spec/lib/imgproxy-rails/transformer_spec.rb @@ -35,6 +35,7 @@ { width: 500, height: 500, + enlarge: true, resizing_type: :fit, rotate: 90, format: :jpg,