Liquid Template Variables - image

From Spiffy Stores Knowledge Base

Revision as of 12:16, 6 November 2013 by Admin (talk | contribs)

The Liquid template variable image cannot be invoked on its own. It is only available as a result of calling the image attributes on product and collection variables.

The variable has the following attributes:

image.id

Returns the unique internal number of the image.

This is normally only for internal usage.

image.product_id

Returns the unique internal number of the product that the image belongs to.

This value is the same as product.id.

image.collection_id

Returns the unique internal number of the collection that the image belongs to.

This value is the same as collection.id.

image.position

Returns the position of the image within the collection of images belonging to the product or collection.

It is the same as the value of forloop.index when you iterate through the array of images returned by product.images or collection.images.

The featured, or first, image of the product or collection will always have a position value of 1.