Magento 2 Get file URL of the static content folder in Controller

<?php class … protected $_assetRepo; public function __construct( …. MagentoFrameworkViewAssetRepository $assetRepo, …. ) { …. $this->_assetRepo = $assetRepo; …. } Now, In you case module name is : Company_Helloworld and you want icon.png from images directory so  echo $this->_assetRepo->getUrl(“Company_Helloworld::images/icon.png”); Hope…

Read More