/**
  * Renders an <img> HTML tag for a filetype icon for a given Neos.Media's asset instance
  *
  * @param AssetInterface $file
  * @param integer|null $width
  * @param integer|null $height
  * @return string
  */
 public function render(AssetInterface $file, $width = null, $height = null)
 {
     $icon = FileTypeIconService::getIcon($file, $width, $height);
     $this->tag->addAttribute('src', $this->resourceManager->getPublicPackageResourceUriByPath($icon['src']));
     $this->tag->addAttribute('alt', $icon['alt']);
     if ($width !== null) {
         $this->tag->addAttribute('width', $width);
     }
     if ($height !== null) {
         $this->tag->addAttribute('height', $height);
     }
     return $this->tag->render();
 }
 /**
  * @param Thumbnail $thumbnail
  * @return void
  * @throws Exception\NoThumbnailAvailableException
  */
 public function refresh(Thumbnail $thumbnail)
 {
     try {
         $width = $thumbnail->getConfigurationValue('width') ?: $thumbnail->getConfigurationValue('maximumWidth');
         $height = $thumbnail->getConfigurationValue('height') ?: $thumbnail->getConfigurationValue('maximumHeight');
         /** @var AssetInterface $asset */
         $asset = $thumbnail->getOriginalAsset();
         $icon = FileTypeIconService::getIcon($asset, $width, $height);
         $thumbnail->setStaticResource($icon['src']);
         $thumbnail->setWidth($icon['width']);
         $thumbnail->setHeight($icon['height']);
     } catch (\Exception $exception) {
         $message = sprintf('Unable to generate thumbnail for the given image (filename: %s, SHA1: %s)', $thumbnail->getOriginalAsset()->getResource()->getFilename(), $thumbnail->getOriginalAsset()->getResource()->getSha1());
         throw new Exception\NoThumbnailAvailableException($message, 1433109654, $exception);
     }
 }