Skip to main content

img_tag
Deprecated

string | img_tag
returns string

Generates an HTML <img> tag for a given image URL.

You can also use the img_tag filter on the following objects:

Deprecated

The img_tag filter has been replaced by image_tag.

{{ product | img_tag }}

Output

<img src="//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744" alt="" />
variable | img_tag: string, string, string

The img_tag filter accepts 3 unnamed parameters, separated by commas, to specify the alt and class attributes, and the size of the image. Because the parameters are read in that order, you must include a value for each parameter before the last parameter you want to specify. If you don't want to include a parameter that precedes one that you do want to include, then you can set the value to an empty string.


Note

The size attribute of the img_tag filter can't be used in conjunction with the img_url filter. If both are used, then the img_url filter will override the size parameter of the img_tag filter.


{{ product | img_tag: 'image alt text', '', '450x450' }}

Output

<img src="//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_450x450.jpg?v=1683744744" alt="image alt text" class="" />
Was this page helpful?