6

I have an image in:

/var/www/html/app/design/frontend/Alothemes/milano/web/images/natale/IMG_7300.JPG

How can I refer to this image in CMS block? I know I should use:

<img src="{{media url="..."}}" alt="" />

What shall I put instead of "..." ?

Thanks

15
  1. Use Of {{view url=""}}

You have to use view url like below for all images are coming from theme folder,

app/design/frontend/{Vendor}/{themename}/web/images/

{{view url="images/natale/IMG_7300.JPG"}}

You can use in your static block or page using below way,

<img src="{{view url="images/natale/IMG_7300.JPG"}}" alt="" />

  1. Use Of {{media url=""}}

For All images That are coming from pub/media folder,

path like, pub/media/customfolder/imagename.jpg at that time use media url.

You have to use {{media url="customfolder/imagename.jpg"}}

<img src="{{media url="customfolder/imagename.jpg"}}" alt="" />

  • 3
    to add an explanation {{media}} directive works only for assets located in the media folder. – Marius Dec 13 '16 at 10:13
  • @Marius, ok sure, i will explain in more. Thanks. – Rakesh Jesadiya Dec 13 '16 at 10:15
  • @Marius, I have updated my answer. – Rakesh Jesadiya Dec 13 '16 at 10:27

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