Remove animation for image uploads

This commit is contained in:
Karina Kwiatek 2023-12-12 00:20:40 +01:00
parent a70b967919
commit 77a801d6ad
1 changed files with 7 additions and 1 deletions

View File

@ -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