Commit 227819bd authored by Andrea Ruggiero's avatar Andrea Ruggiero
Browse files

fix

parent ca2a0d68
Pipeline #1585 failed with stage
in 1 minute and 22 seconds
......@@ -70,7 +70,7 @@ class EventController extends Controller
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"places" => $places,
"image" => count($places) > 0 ? $this->getImage($places[0]) : null
"image" => count($places) > 0 ? $this->getImage($places[0], $event->title) : null
];
if ($user !== null) {
......@@ -135,7 +135,7 @@ class EventController extends Controller
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"places" => $places,
"image" => count($places) > 0 ? $this->getImage($places[0]) : null
"image" => count($places) > 0 ? $this->getImage($places[0], $event->title) : null
];
$response[] = $temp;
......@@ -220,7 +220,7 @@ class EventController extends Controller
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"places" => $places,
"image" => count($places) > 0 ? $this->getImage($places[0]) : null
"image" => count($places) > 0 ? $this->getImage($places[0], $event->title) : null
];
if ($user !== null) {
......@@ -230,7 +230,7 @@ class EventController extends Controller
return ApiResponse::success([ 'event' => $response]);
}
private function getImage($place) {
private function getImage($place, $title) {
$total = [
0 => 6,
1 => 0,
......@@ -241,7 +241,7 @@ class EventController extends Controller
6 => 2
];
if ($total[$place["id"]] == 0) return null;
$md5 = md5($place["place"]);
$md5 = md5($title);
return 'http://185.53.148.21/'.$place["id"].'/'.abs($md5[0] % $total[$place["id"]]).'.jpg';
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment