Example #1
0
 /**
  * @param Hotel $hotel
  * @return bool|string
  */
 public function gmapHotel(Hotel $hotel, $marker, $width = 258, $height = 180)
 {
     $dir = $this->imageDir . 'hotel';
     $imagePath = sprintf('%s/%s-%s-%s.png', $dir, $hotel->getId(), $width, $height);
     if (!file_exists($dir)) {
         $this->filesystem->mkdir($dir);
     }
     if (!file_exists($imagePath)) {
         $gmapImage = sprintf('http://maps.googleapis.com/maps/api/staticmap?center=%s,%s&zoom=14&size=%sx%s&markers=%s%s,%s&sensor=false', $hotel->getLatitude(), $hotel->getLongitude(), $width, $height, $marker ? sprintf('icon:%s%%7C', $marker) : '', $hotel->getLatitude(), $hotel->getLongitude());
         file_put_contents($imagePath, file_get_contents($gmapImage));
     }
     $webPath = strstr($imagePath, 'web/');
     return substr($webPath, 4);
 }
Example #2
0
 /**
  * @param Hotel $hotel
  *
  * @return $this
  */
 public function removeHotel($hotel)
 {
     $this->hotelType->deleteById($hotel->getId());
 }