From a6771dbfe568e9cf716274a73970d60cfe293483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Wed, 10 Apr 2024 12:34:59 +0200 Subject: [PATCH] Add CW uploaders for migration --- .../cover_image_uploader.rb | 16 +++++++++++++++ .../item_image_uploader.rb | 20 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 app/uploaders/decidim/cw/alternative_landing/cover_image_uploader.rb create mode 100644 app/uploaders/decidim/cw/alternative_landing/item_image_uploader.rb diff --git a/app/uploaders/decidim/cw/alternative_landing/cover_image_uploader.rb b/app/uploaders/decidim/cw/alternative_landing/cover_image_uploader.rb new file mode 100644 index 0000000..dd238e0 --- /dev/null +++ b/app/uploaders/decidim/cw/alternative_landing/cover_image_uploader.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Decidim::Cw + module AlternativeLanding + # This class deals with uploading cover images to content blocks. + class CoverImageUploader < RecordImageUploader + version :big do + process resize_to_fit: [2880, 1620] + end + + def max_image_height_or_width + 8000 + end + end + end +end diff --git a/app/uploaders/decidim/cw/alternative_landing/item_image_uploader.rb b/app/uploaders/decidim/cw/alternative_landing/item_image_uploader.rb new file mode 100644 index 0000000..a12905a --- /dev/null +++ b/app/uploaders/decidim/cw/alternative_landing/item_image_uploader.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Decidim::Cw + module AlternativeLanding + # This class deals with uploading item images to content blocks. + class ItemImageUploader < RecordImageUploader + version :square do + process resize_to_fill: [960, 960] + end + + version :landscape do + process resize_to_fill: [960, 540] + end + + def max_image_height_or_width + 4000 + end + end + end +end