From 77a801d6ad746ce4b6b126f70e0cb4b5c2aa25bf Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Tue, 12 Dec 2023 00:20:40 +0100 Subject: [PATCH] Remove animation for image uploads --- app/uploaders/base_uploader.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/uploaders/base_uploader.rb b/app/uploaders/base_uploader.rb index 5478042c..c93fbffa 100644 --- a/app/uploaders/base_uploader.rb +++ b/app/uploaders/base_uploader.rb @@ -8,7 +8,7 @@ class BaseUploader < CarrierWave::Uploader::Base # Store original size version :original - # Process cropping on upload + process :remove_animation process :cropping def content_type_whitelist = %w[image/jpeg image/gif image/png] @@ -33,4 +33,10 @@ class BaseUploader < CarrierWave::Uploader::Base image.crop "#{w}x#{h}+#{x}+#{y}" end end + + def remove_animation + return unless content_type == "image/gif" + + manipulate!(&:collapse!) + end end