0

I have a phtml file in my theme that is added to category page via XML updates tab.

I read image in phtml like so:

$this->getUrl('media/catalog/category/').$_category->getImageUrl()

My theme has 2 store view nl-be, fr-be and one of them has store code to url like so:

NL-BE = https://magento2.com/media/catalog/category/image.jpg


NL-FR = https://magento2.com/fr-be/media/catalog/category/image.jpg //THIS IMAGE GOES 404

Anyone any idea?

0

Basically you need to create Symlinks for the same Directory.

If you don't know, how to Symlinks then please refer this link:

  • in my opinion the images should return 200 out of the box I can see that magento native itself doesn't add the store code to any images urls either another options is to use: <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $conf = $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue("web/unsecure/base_url", "\Magento\Store\Model\ScopeInterface::SCOPE_STORES");?> – Juliano Vargas Oct 1 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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