From f2225e700a25954f6d6958118773d6da1cd6fa59 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 15 Oct 2022 12:37:55 +0200 Subject: [PATCH] change MAX_IMAGE_SIZE_BANNER_RESIZED_MB into MAX_IMAGE_SIZE_BANNER_RESIZED_KB --- files/helpers/const.py | 2 +- files/helpers/media.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index fd172f744..d419058f9 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -394,7 +394,7 @@ GIFT_NOTIF_ID = 5 SIGNUP_FOLLOW_ID = 0 NOTIFICATION_THREAD = 1 -MAX_IMAGE_SIZE_BANNER_RESIZED_MB = 0.5 +MAX_IMAGE_SIZE_BANNER_RESIZED_KB = 500 MAX_IMAGE_AUDIO_SIZE_MB = 8 MAX_IMAGE_AUDIO_SIZE_MB_PATRON = 16 MAX_VIDEO_SIZE_MB = 32 diff --git a/files/helpers/media.py b/files/helpers/media.py index 14182e0ed..1b7408223 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -153,9 +153,9 @@ def process_image(filename=None, resize=0, trim=False, uploader=None, patron=Fal if resize in (300,400,1200): - if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_MB * 1024 * 1024: + if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_KB * 1024: os.remove(filename) - abort(413, f"Max size for banners, sidebars, and badges is {MAX_IMAGE_SIZE_BANNER_RESIZED_MB}") + abort(413, f"Max size for banners, sidebars, and badges is {MAX_IMAGE_SIZE_BANNER_RESIZED_KB} KB") if resize == 1200: path = f'files/assets/images/{SITE_NAME}/banners'