Neos\Flow\ResourceManagement\ResourceManager::getPublicPackageResourceUriByPath PHP Method

getPublicPackageResourceUriByPath() public method

Returns the public URI for a static resource provided by the public package
public getPublicPackageResourceUriByPath ( string $path ) : string
$path string The ressource path, like resource://Your.Package/Public/Image/Dummy.png
return string
    public function getPublicPackageResourceUriByPath($path)
    {
        $this->initialize();
        list($packageKey, $relativePathAndFilename) = $this->getPackageAndPathByPublicPath($path);
        return $this->getPublicPackageResourceUri($packageKey, $relativePathAndFilename);
    }

Usage Example

 /**
  * 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();
 }
All Usage Examples Of Neos\Flow\ResourceManagement\ResourceManager::getPublicPackageResourceUriByPath