Magento 2 - How to load image from theme in frontend?
Pregunta
I uploaded the image amazon-pay-ic.svg to THEME/web/images/.
How can I load it in the frontend?
I tried www.example.com/images/amazon-pay-ic.svg
but it does not work and shows the 404 site.
Solución
<img src="{{view url="images/amazon-pay-ic.svg"}}" alt="test" />
inside PHTML templates, then flush full_page and block_html caches.
For HTML templates use this:
<img data-bind="attr: { src: require.toUrl('images/amazon-pay-ic.svg') }" alt="test" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange