Magento2: How to get images inserted in custom theme's media folder?

by Raj   Last Updated September 29, 2018 11:09 AM

I'm trying to get image which is inserted in /app/design/frontend/Mytheme/themename/media folder using following code but it's shows 404 not found. I have also apply cache clean & static content deploy command but still not working. I'm using below code in my phtml file:-

$mediaurl = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
$image = $mediaurl."myimg.png";
echo $image;

So is it possible to get images of media folder in M2? Any suggestion should be appreciated. Thanks.

Answers 1

try this:

September 29, 2018 11:41 AM

Related Questions

How to link to images from a Javascript file

Updated September 08, 2017 01:09 AM