* (which is set to null because we don't want a single event) * and whether to get the dates (true) and prices (also true). */ if ($results = $info->getEvents($producer, null, true, true)) { // The getEvents returns an array of events so merge the results // into the events array. $events = array_merge($events, $results); } } } // Let's grab each event's image. foreach ($events as &$event) { // The getImages method needs the event ID. // This will return an array of images. Each image has a 'large', // 'medium', 'small' field. $image = $info->getImages($event['id']); // If the getImages method returns a false value, generate a gravatar // to use a placeholder image. if (!$image || $image === '') { $gravatar = new \thomaswelton\GravatarLib\Gravatar(); $gravatar->setDefaultImage('retro'); $gravatar->enableSecureImages(); $gravatar->setAvatarSize(250); // Set the event's image field to the generated gravatar. $event['image'] = $gravatar->buildGravatarURL($event['title']); } else { // Set the event's image field to the first image and the largest version. $event['image'] = str_replace('http:', 'https:', $image[0]['large']); } // Logging the results of the image for the heck of it. $this->logger->info($event['image']);