Ad

Shopify Image Not Showing

- 1 answer

I'm just to display an image i have uploaded into files with <img src="{{ 'defaultcollection.jpg' | asset_url }}" /> It's just displaying the broken image icon. If I copy in the url https://cdn.shopify.com/s/files/1/1396/0463/files/defaultcollection.jpg?13042980317671635283 it displays fine. I'm wanting to do it the first way so it is able to be changed easily rather than go into the code and adjust it. How am I able to get this to display?

Ad

Answer

Try something like this:

<img src="{{ 'defaultcollection.jpg' | file_url }}" />

The file_img_url filter would also work (and has the added feature of allowing you to resize the image): https://help.shopify.com/themes/liquid/filters/url-filters#file_img_url

Ad
source: stackoverflow.com
Ad