Can I use the 'img_url' helper in combination with 'asset', or is that the wrong question?

#1

I have an image in a theme template (images/dan.jpg) where I’m using it in a img tag on a page template.
To access that, right now I’m using {{asset "/images/dan.jpg"}}.
But what if I also want to take advantage of img_url and get multiple sizes?

I can’t see a way to do {{img_url {{asset "/images/dan.jpg"}} size="s"}} or something like that…

Is that simply not possible at the moment, or is there something fundamentally wrong with this approach, and I should do it some other way entirely?

0 Likes

#2

@LucidDan that won’t work because {{img_url}} works with uploaded content images rather than theme assets.

If you are using assets in your theme it’s currently expected that you optimise them manually and put any necessary HTML for responsive images in your template files as you would if making a static site. Theme assets are known files and have known specific use-cases so you can optimise much more efficiently than any automatic optimisation.

0 Likes

closed #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

0 Likes