From 562615672fb00e90ae1e15a4cb1e08d5841284e9 Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Sun, 13 Jul 2025 18:29:23 +0200 Subject: [PATCH] =?UTF-8?q?Dodaj=20walidacj=C4=99=20proporcji=20dla=20obra?= =?UTF-8?q?zk=C3=B3w=20g=C3=B3rnych=20i=20dolnych=20w=20formularzu=20og?= =?UTF-8?q?=C5=82oszenia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../front/factory/class.GlobelusFirms.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/autoload/front/factory/class.GlobelusFirms.php b/autoload/front/factory/class.GlobelusFirms.php index a22e3a1..f372eae 100644 --- a/autoload/front/factory/class.GlobelusFirms.php +++ b/autoload/front/factory/class.GlobelusFirms.php @@ -1162,14 +1162,14 @@ class GlobelusFirms $advert_add_img_top_error = false; - if ($advert_add_img_top['tmp_name'] and $advert_add_img_top["size"] > 1048576) + if ( $advert_add_img_top['tmp_name'] and $advert_add_img_top["size"] > 1048576 ) { \S::set_alert_prompt('Informacja', $lang['plik-logo-jest-zbyt-duzy']); $advert_add_img_top_error = true; return false; } - if ($advert_add_img_top['tmp_name'] and !$advert_add_img_top_error and !in_array($advert_add_img_top["type"], $allowed_mime_types_advert_top)) + if ( $advert_add_img_top['tmp_name'] and !$advert_add_img_top_error and !in_array($advert_add_img_top["type"], $allowed_mime_types_advert_top ) ) { \S::set_alert_prompt('Informacja', $lang['logo-niedozwolony-format-pliku']); return false; @@ -1177,6 +1177,15 @@ class GlobelusFirms if ($advert_add_img_top['tmp_name'] and !$advert_add_img_top_error) { + // >>> WALIDACJA PROPORCJI + list($width, $height) = getimagesize($advert_add_img_top['tmp_name']); + $ratio = $width / $height; + + if ($ratio < 2.6667 || $ratio > 8.0) { + \S::set_alert_prompt('Informacja', 'Obrazek górny ma nieprawidłowe proporcje. Dozwolony zakres to od 2.66:1 do 8:1.'); + return false; + } + $advert_add_img_top_hash = \front\factory\GlobelusFirms::advert_add_img_top_hash($advert_id); $dir = 'files/advert_add_img_top/' . $advert_add_img_top_hash[0] . '/' . $advert_add_img_top_hash[1] . '/'; @@ -1211,6 +1220,15 @@ class GlobelusFirms if ($advert_add_img_bottom['tmp_name'] and !$advert_add_img_bottom_error) { + // >>> WALIDACJA PROPORCJI + list($width, $height) = getimagesize($advert_add_img_bottom['tmp_name']); + $ratio = $width / $height; + + if ($ratio < 2.6667 || $ratio > 8.0) { + \S::set_alert_prompt('Informacja', 'Obrazek dolny ma nieprawidłowe proporcje. Dozwolony zakres to od 2.66:1 do 8:1.'); + return false; + } + $advert_add_img_bottom_hash = \front\factory\GlobelusFirms::advert_add_img_bottom_hash($advert_id); $dir = 'files/advert_add_img_bottom/' . $advert_add_img_bottom_hash[0] . '/' . $advert_add_img_bottom_hash[1] . '/';