Skip to main content

img_url
Deprecated

variable | img_url
returns string

Returns the CDN URL for an image.

You can use the img_url filter on the following objects:

Deprecated

The img_url filter has been replaced by image_url.

{{ product | img_url }}

Output

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744
variable | img_url: string

The size parameter allows you to specify the dimensions of the image up to a maximum of 5760 x 5760 px. You can specify only the width, only the height, or both, and you can also use the following named sizes:

NameDimensions
pico16x16 px
icon32x32 px
thumb50x50 px
small100x100 px
compact160x160 px
medium240x240 px
large480x480 px
grande600x600 px
original
master
1024x1024 px
{{ product | img_url: '480x' }}

{{ product | img_url: 'x480' }}

{{ product | img_url: '480x480' }}

{{ product | img_url: 'large' }}

Output

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_480x.jpg?v=1683744744

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_x480.jpg?v=1683744744

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_480x480.jpg?v=1683744744

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_large.jpg?v=1683744744
variable | img_url: crop: string

The crop parameter allows you to specify which part of the image to show if the specified dimensions result in an aspect ratio that differs from the original. You can use the following values:

  • top
  • center
  • bottom
  • left
  • right

The default value is center.

{{ product | img_url: crop: 'bottom' }}

Output

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744
variable | img_url: format: string

Specify which file format to use for the image. The valid formats are pjpg and jpg.

It's not practical to convert a lossy image format, like jpg, to a lossless image format, like png, so this filter does only the following conversions:

  • png to jpg
  • png to pjpg
  • jpg to pjpg

Note

Shopify automatically detects which image formats are supported by the client (e.g. WebP, AVIF, etc.) and selects a file format for optimal quality and file size. When a format is specified, Shopify takes into account the features (e.g. progressive, alpha channel) of the specified file format when making the final automatic format selection. To learn more, visit https://cdn.shopify.com/.


{{ product | img_url: format: 'pjpg' }}

Output

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744
variable | img_url: scale: number

Specify the pixel density of the image. The valid densities are 2 and 3.

{{ product | img_url: scale: 2 }}

Output

//polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744
Was this page helpful?