Ad

Getting Specific Image Sizes From Asset_url

- 1 answer

I'm trying to take advantage of the image size parameter, but it seems to not work on assets stored in my assets folders? The following:

<img src="{{"image.png" | asset_url : '100x100'}}">

Throws this error:

Liquid error: wrong number of arguments (given 2, expected 1)

Do I have to manually resize these assets? The above works just fine without the '100x100', loads the image and whatnot.

Ad

Answer

You have to use asset_img_url filter instead of asset_url. Doing so, your code should become

<img src="{{'image.png' | asset_img_url : '100x100'}}">

Shopify Docs for Asset Image Filter

Ad
source: stackoverflow.com
Ad