Dodaj walidację proporcji dla obrazków górnych i dolnych w formularzu ogłoszenia
This commit is contained in:
@@ -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] . '/';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user