Example #1
0
 /**
  * @return string
  */
 public function format()
 {
     return $this->format->value();
 }
 /**
  * @test
  * @dataProvider formatsProvider
  */
 public function validFormatOfPhotos($value)
 {
     $format = new PhotoFormat($value);
     $this->assertTrue($format->value() === $value);
 }
 /**
  * @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()));
 }
 /**
  * @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)
 {
     $urlBase = $this->localStorageConfig->urlBase();
     $urlBase = $urlBase[strlen($urlBase) - 1] === '/' ? substr($urlBase, 0, -1) : $urlBase;
     return new HttpUrl(implode('/', [$urlBase, $this->getMd5Path($resourceId->id()), $photoId->id(), $photoName->slug()]) . '_' . $photoThumbSize->width() . 'x' . $photoThumbSize->height() . '.' . $photoFormat->value());
 }