image_url
Returns the remote CDN link of the image.
You can get the image URL of the following data objects by using the image_url filter.
image object src
Image.
article object image.src
Article.
line_item object image.src
Each line of product data in the shopping cart, checkout, or order.
variant object image.src
Product variant.
product object featured_image.src
Product.
collection object featured_image.src
Product category.
video object preview_image.src
Video.
variable | image_url(width=number, height=number, quality=number) returns [string]
Params
-
variableobject: data object
Hash Params
-
widthnumber: Image width -
heightnumber: Image height -
qualitynumber: Image compression ratio
Example
Set image width
If you only specify the image width, the image height will be scaled proportionally to the original image.
variable | image_url(width=number)
{{ product | image_url(width=100) }}
Set image height
If you only specify the image height, the image width will be scaled proportionally to the original image.
variable | image_url(height=number)
{{ product | image_url(height=100) }}
Set image compression ratio
The default value is 80 and the selectable range is 0 to 100.
variable | image_url(quality=number)
{{ product | image_url(quality=90) }}