Example #1
0
 /**
  * @return PhotoStorage
  */
 public function getPhotoStorage()
 {
     switch ($this->storage->driver()) {
         case Storage::STORAGE_LOCAL:
             return new PhotoLocalStorage(LocalStorageConfig::getInstanceByArray($this->storage->config()));
             break;
         case Storage::STORAGE_S3_AMAZON:
             return new AmazonS3PhotoStorage(AmazonS3Config::getInstanceByArray($this->storage->config()), $this->thumbGeneratorConfig);
             break;
         default:
             throw new \InvalidArgumentException(sprintf('Invalid storage driver "%s"', $this->storage->driver()));
             break;
     }
 }
 /**
  * @param PhotoId $photoId
  * @param ResourceId $resourceId
  * @param PhotoName $photoName
  * @param PhotoThumbSize $photoThumbSize
  * @param PhotoFormat $photoFormat
  * @return HttpUrl
  */
 public function getPhotoThumbHttpUrlBy(PhotoId $photoId, ResourceId $resourceId, PhotoName $photoName, PhotoThumbSize $photoThumbSize, PhotoFormat $photoFormat)
 {
     return new HttpUrl($this->config->urlBase() . '/' . $this->getThumbUri($photoId->id(), $photoName->slug(), $photoThumbSize->width(), $photoThumbSize->height(), $photoFormat->value()));
 }