From aca9df29104e4641cd5f821a807c0a55ec1233d9 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Thu, 18 Feb 2021 02:00:34 +0100 Subject: [PATCH] Allow uploads of images up to 8000x8000 but shrink to 2000x2000 --- app/uploaders/image_uploader.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index d372e4f..0167487 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -4,7 +4,7 @@ class ImageUploader < Shrine ALLOWED_TYPES = %w[image/jpeg image/png image/webp] MAX_SIZE = 5*1024*1024 # 5 MB - MAX_DIMENSIONS = [4000, 4000] # 2000x2000 + MAX_DIMENSIONS = [8000, 8000] # larger than 2000x2000 will be resized plugin :remove_attachment plugin :pretty_location @@ -29,7 +29,7 @@ class ImageUploader < Shrine thumb: magick.resize_to_limit!(160,120), small: magick.resize_to_limit!(320, 240), #medium: magick.resize_to_limit!(800, 600), - large: magick.composite!('public/logo/watermark.png', gravity: 'east') + large: magick.resize_to_limit(2000,2000).composite!('public/logo/watermark.png', gravity: 'east') } # GenerateThumbnail.call(original, width, height) # lib/generate_thumbnail.rb