From cdab52dba13074916531c904456633db7341671d Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Mon, 24 Apr 2023 10:13:15 +0800 Subject: [PATCH] Fix gravity bug for resize_to_fill. --- app/uploaders/gallery_uploader.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/uploaders/gallery_uploader.rb b/app/uploaders/gallery_uploader.rb index 839cd9e..1b53d63 100644 --- a/app/uploaders/gallery_uploader.rb +++ b/app/uploaders/gallery_uploader.rb @@ -181,13 +181,14 @@ class GalleryUploader < CarrierWave::Uploader::Base if thumb_process_option == 0 thumb_process_option = OrbitHelper::SharedHash['gallery'][:thumb_process_option] end + resize_gravity = (now_album.resize_gravity rescue 'Center') case thumb_process_option when 1 - resize_and_pad(w, h, (transparent? ? :transparent : now_album.album_colors.first['color']), (now_album.resize_gravity rescue 'Center')) + resize_and_pad(w, h, (transparent? ? :transparent : now_album.album_colors.first['color']), resize_gravity) when 2 limit_process(w, h) when 3 - resize_to_fill(w, h) + resize_to_fill(w, h, resize_gravity) end end end