image url Syntax is ok for both static block
and phtml
, But make sure that when you write this code in static block
| <span class="tag"><img</span> <span class="atn">src</span><span class="pun">=</span><span class="atv">"{{view url="</span><span class="atn">images</span><span class="pun">/</span><span class="atn">slide-bg</span><span class="pln">.</span><span class="atn">jpg</span><span class="atv">"}}"</span> <span class="atn">alt</span><span class="pun">=</span><span class="atv">"test"</span> <span class="tag">/></span> |
on front end it looks like
http://localhost/magento2new/pub/static/frontend/Magento/luma/en_US/images/slide-bg.jpg
Where Magento/luma
is package
name and theme
name, you can replace with your package
and theme
name
So you have to take care for slide-bg.jpg
is exist in
pub/static/frontend/Magento/luma/en_US/images
directory.
In your case,
| <span class="pln"><img src='</span><span class="pun"><?</span><span class="pln">php echo $this</span><span class="pun">-></span><span class="pln">getViewFileUrl</span><span class="pun">(</span><span class="str">'images/footer-logo.png'</span><span class="pun">);</span> <span class="pun">?></span><span class="pln">' alt="Demo"></span> |
Syntax seems ok , but in frontend It looks like
http://localhost/magento2new/pub/static/frontend/Magento/luma/en_US/images/footer-logo.png
So you have to make sure that footer-logo.png
exist in
pub/static/frontend/Magento/luma/en_US/images
directory.
And don’t forgot about "[quotation marks]
In CSS:
background: url('{{view url="images/menu-button-of-three-lines.svg"}}');