Exemplo n.º 1
0
 /**
  * Transforms an Image with some resizing information into an ETag.
  *
  * @param ImageInterface $image  Image
  * @param string         $height Height
  * @param string         $width  Width
  * @param string         $type   Type of resizing
  *
  * @return string ETag generated
  */
 public function transform(ImageInterface $image, $height, $width, $type)
 {
     return sha1($image->getId() . '.' . $image->getUpdatedAt()->getTimestamp() . '.' . $height . '.' . $width . '.' . $type);
 }
Exemplo n.º 2
0
 /**
  * Return route of image
  *
  * @param ImageInterface $imageMedia  Imagemedia element
  * @param bool           $absoluteUrl If the url generated shoud be absolute
  *
  * @return string image route
  */
 public function viewImage(ImageInterface $imageMedia, $absoluteUrl = false)
 {
     $this->prepareRouterContext();
     $routeReferenceType = $this->getReferenceType($absoluteUrl);
     $generatedRoute = $this->router->generate($this->imageViewControllerRouteName, ['id' => (int) $imageMedia->getId(), '_format' => $imageMedia->getExtension()], $routeReferenceType);
     $this->fixRouterContext();
     return $generatedRoute;
 }
Exemplo n.º 3
0
 /**
  * Return route of image
  *
  * @param ImageInterface $imageMedia Imagemedia element
  *
  * @return string image route
  */
 public function viewImage(ImageInterface $imageMedia)
 {
     return $this->router->generate($this->imageViewControllerRouteName, array('id' => (int) $imageMedia->getId()), true);
 }