/**
  * Renders an <img> HTML tag for a filetype icon for a given TYPO3.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 ImageInterface $thumbnail
  * @return string
  * @throws ThumbnailServiceException
  */
 public function getUriForThumbnail(ImageInterface $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);
     }
     return $this->resourceManager->getPublicPackageResourceUriByPath($staticResource);
 }
 /**
  * If ui.help.message is set in $configuration, translate it if requested and then convert it from markdown to HTML.
  *
  * @param array $configuration
  * @param string $idPrefix
  * @param string $nodeTypeName
  * @return void
  */
 protected function translateAndConvertHelpMessage(array &$configuration, $idPrefix, $nodeTypeName = null)
 {
     $helpMessage = '';
     if (isset($configuration['ui']['help'])) {
         // message handling
         if (isset($configuration['ui']['help']['message'])) {
             if ($this->shouldFetchTranslation($configuration['ui']['help'], 'message')) {
                 $translationIdentifier = $this->splitIdentifier($idPrefix . 'ui.help.message');
                 $helpMessage = $this->translator->translateById($translationIdentifier['id'], [], null, null, $translationIdentifier['source'], $translationIdentifier['packageKey']);
             } else {
                 $helpMessage = $configuration['ui']['help']['message'];
             }
         }
         // prepare thumbnail
         if ($nodeTypeName !== null) {
             $thumbnailUrl = '';
             if (isset($configuration['ui']['help']['thumbnail'])) {
                 $thumbnailUrl = $configuration['ui']['help']['thumbnail'];
                 if (strpos($thumbnailUrl, 'resource://') === 0) {
                     $thumbnailUrl = $this->resourceManager->getPublicPackageResourceUriByPath($thumbnailUrl);
                 }
             } else {
                 # look in well know location
                 $splitPrefix = $this->splitIdentifier($nodeTypeName);
                 $relativePathAndFilename = 'NodeTypes/Thumbnails/' . $splitPrefix['id'] . '.png';
                 $resourcePath = 'resource://' . $splitPrefix['packageKey'] . '/Public/' . $relativePathAndFilename;
                 if (file_exists($resourcePath)) {
                     $thumbnailUrl = $this->resourceManager->getPublicPackageResourceUriByPath($resourcePath);
                 }
             }
             if ($thumbnailUrl !== '') {
                 $helpMessage = '![alt text](' . $thumbnailUrl . ') ' . $helpMessage;
             }
         }
         if ($helpMessage !== '') {
             $helpMessage = $this->markdownConverter->convertToHtml($helpMessage);
             $helpMessage = $this->addTargetAttribute($helpMessage);
         }
     }
     $configuration['ui']['help']['message'] = $helpMessage;
 }