diff --git a/lib/rails_admin/config/fields/types/active_storage.rb b/lib/rails_admin/config/fields/types/active_storage.rb index a8c6e71174..6d03d6768d 100644 --- a/lib/rails_admin/config/fields/types/active_storage.rb +++ b/lib/rails_admin/config/fields/types/active_storage.rb @@ -8,7 +8,11 @@ class ActiveStorage < RailsAdmin::Config::Fields::Types::FileUpload RailsAdmin::Config::Fields::Types.register(self) register_instance_option :thumb_method do - {resize: '100x100>'} + if Gem.loaded_specs.key?('ruby-vips') + {resize_to_limit: [100, 100]} + else + {resize: '100x100>'} + end end register_instance_option :delete_method do diff --git a/lib/rails_admin/config/fields/types/multiple_active_storage.rb b/lib/rails_admin/config/fields/types/multiple_active_storage.rb index f53353abb8..6ca2be7649 100644 --- a/lib/rails_admin/config/fields/types/multiple_active_storage.rb +++ b/lib/rails_admin/config/fields/types/multiple_active_storage.rb @@ -9,7 +9,11 @@ class MultipleActiveStorage < RailsAdmin::Config::Fields::Types::MultipleFileUpl class ActiveStorageAttachment < RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment register_instance_option :thumb_method do - {resize: '100x100>'} + if Gem.loaded_specs.key?('ruby-vips') + {resize_to_limit: [100, 100]} + else + {resize: '100x100>'} + end end register_instance_option :delete_value do