From 8bc43445f1d0b70d54d0a45830e04d0fcc406fbe Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 1 Feb 2024 15:24:17 +0700 Subject: Fix image watermark API --- indoteknik_api/controllers/controller.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indoteknik_api/controllers/controller.py') diff --git a/indoteknik_api/controllers/controller.py b/indoteknik_api/controllers/controller.py index 0592afe1..a362e6a6 100644 --- a/indoteknik_api/controllers/controller.py +++ b/indoteknik_api/controllers/controller.py @@ -230,16 +230,6 @@ class Controller(http.Controller): new_img = img - if version == '2': - logo__footer_path = get_module_resource('indoteknik_api', 'static', 'src', 'images', 'logo-indoteknik-footer.png') - logo__footer_img = Image.open(logo__footer_path).convert('RGBA') - logo__footer_img.thumbnail((img_width, img_height // 1)) - logo_footer_w, logo_footer_h = logo__footer_img.size - new_img.paste(logo__footer_img, (0, img_height - logo_footer_h), logo__footer_img) - - logo_img_w = img_width // 1.8 - logo_img_h = img_height // 1.8 - if ratio == 'square': new_img = Image.new('RGBA', (longest_wh, longest_wh), (255, 255, 255, 255)) @@ -247,6 +237,16 @@ class Controller(http.Controller): paste_y = (longest_wh - img_height) // 2 new_img.paste(img, (paste_x, paste_y), img) + + if version == '2': + logo__footer_path = get_module_resource('indoteknik_api', 'static', 'src', 'images', 'logo-indoteknik-footer.png') + logo_footer_img = Image.open(logo__footer_path).convert('RGBA') + logo_footer_img.thumbnail((img_width, img_height // 1)) + logo_footer_w, logo_footer_h = logo_footer_img.size + new_img.paste(logo_footer_img, (0, img_height - logo_footer_h), logo_footer_img) + + logo_img_w = img_width // 1.8 + logo_img_h = img_height // 1.8 logo_img.thumbnail((logo_img_w, logo_img_h)) -- cgit v1.2.3