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.

1 Answer 1


try this:

  • Hi. Still not working.
    – Raj
    Oct 2, 2018 at 13:39
  • @Raj i am using same code for display image. do as follow: copy your image in vendor/theme/web/media/ and add this code in phtml file to get this image to display
    – shyopat
    Oct 3, 2018 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.