image
The image object, such as a collection or product image.
Visit the SHOPLINE Help Center to learn about the image formats supported by SHOPLINE.
Properties
The alt text of the image.
The aspect ratio of the image, expressed as a decimal.
Returns true if the image is related with a variant. Otherwise, returns false.
The attached_to_variant property only applies to image objects accessed through:
Referencing this property on an image from another source will return null.
The height of the image in pixels.
The ID of the image.
Referencing the id property for the preview image of a generic_file or media object returns null.
The media type of the image. Always returns image.
The media_type property only applies to images accessed through:
- product.media
- file_reference type metafields
If this property is referenced on an image from another source, it returns null.
Example
You can use the where helper to filter the media_type property of product.media to get all image objects of the desired type.
{{ assign 'demo_images' (where product.media 'media_type' 'image') }}
{{#each demo_images as |image|}}
{{image_tag (image_url image width=400) class="image-demo" }}
{{/each}}
The position of the image in the product.media or product.images array.
The position property only applies to images related to products. Referencing this property on an image from another source returns null.
The preview image.
The preview_image property only applies to images accessed through:
- product.featured_media
- product.media
- file_reference type metafields
When this property is referenced on an image from another source, it returns null.
The ID of the product related with the image.
The product_id property only applies to images related to products. If this property is referenced on an image from another source, it returns null.
The relative URL of the image.
The variants related with the image.
The variants property only applies to image objects accessed through:
Referencing this property on an image from another source will return null.
The width of the image in pixels.
Directly Referencing an Image Object
When an image object is directly referenced, the relative URL path of the image is returned.
{{ product.featured_image.src }}