Dodaj walidację proporcji dla obrazków górnych i dolnych w formularzu ogłoszenia

This commit is contained in:
2025-07-13 18:29:23 +02:00
parent f43b6081c1
commit 562615672f

View File

@@ -1177,6 +1177,15 @@ class GlobelusFirms
if ($advert_add_img_top['tmp_name'] and !$advert_add_img_top_error) 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); $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] . '/'; $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) 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); $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] . '/'; $dir = 'files/advert_add_img_bottom/' . $advert_add_img_bottom_hash[0] . '/' . $advert_add_img_bottom_hash[1] . '/';