/**
  * Generate thumbnail and redirect to resource URI
  *
  * @param Thumbnail $thumbnail
  * @return void
  */
 public function thumbnailAction(Thumbnail $thumbnail)
 {
     if ($thumbnail->getResource() === null && $thumbnail->getStaticResource() === null) {
         $this->thumbnailService->refreshThumbnail($thumbnail);
     }
     $this->redirectToUri($this->thumbnailService->getUriForThumbnail($thumbnail), 0, 302);
 }
 /**
  * @param Thumbnail $thumbnail
  * @return string
  * @throws ThumbnailServiceException
  */
 public function getUriForThumbnail(Thumbnail $thumbnail)
 {
     $resource = $thumbnail->getResource();
     if ($resource) {
         return $this->resourceManager->getPublicPersistentResourceUri($resource);
     }
     $staticResource = $thumbnail->getStaticResource();
     if ($staticResource === null) {
         throw new ThumbnailServiceException(sprintf('Could not generate URI for static thumbnail "%s".', $this->persistenceManager->getIdentifierByObject($thumbnail)), 1450178437);
     }
     try {
         list($package, $path) = $this->resourceManager->getPackageAndPathByPublicPath($staticResource);
         return $this->resourceManager->getPublicPackageResourceUri($package, $path);
     } catch (Exception $exception) {
         return $staticResource;
     }
 }