Skip to content

ProductImage

The ProductImage object represents a product image.

classDiagram
  direction LR
  ProductImage --> Url
  class Url{
  }
  class ProductImage{
    int id
    string name
    string extension
    Url url
    Url webpUrl
    Url thumbnailUrl
    Url webpThumbnailUrl
    bool isPlaceholder
    bool isFeatured
  }

Properties

Attribute name Type Description
id null|int The unique identifier of the product's image. null value will be only if image is a placeholder and product does not have any image assigned.
name string The name of the product's image.
extension string Extension of the product's image.
url Url The Url object representing an absolute or relative link to the product image.
webpUrl Url The Url object representing an absolute or relative link to the product image in webp format.
thumbnailUrl Url The Url object representing the url to the product image thumbnail. Calling this method you cat set parameters such as width and height to obtain an image thumbnail with the given dimensions.
webpThumbnailUrl Url The Url object representing the url to the product image thumbnail in webp format. Calling this method you cat set parameters such as width and height to obtain an image thumbnail with the given dimensions.
isPlaceholder bool Returns true only if image file does not exist.
isFeatured bool Returns true if image is featured (first image in product gallery).

Examples

id property

{{ productImage.id }}
1

name property

{{ productImage.name }}
T-shirt front view

extension property

{{ productImage.extension }}
jpg

url property

{{ productImage.url }}
/userdata/public/gfx/8e56ac496843f9ac0fb7654d2b8a4be6.jpg
/userdata/public/gfx/847/soda-stream-back.png
/environment/cache/images/0_0_productGfx_8e56ac496843f9ac0fb7654d2b8a4be6.jpg

For the absolute path, link will contain the current protocol.

{{ productImage.url.absolute }}
https://example.com/userdata/public/gfx/8e56ac496843f9ac0fb7654d2b8a4be6.jpg

webpUrl property

{{ productImage.webpUrl }}
/userdata/public/gfx/8e56ac496843f9ac0fb7654d2b8a4be6.webp
/environment/cache/images/0_0_productGfx_8e56ac496843f9ac0fb7654d2b8a4be6.webp
/userdata/public/gfx/847/soda-stream-back.webp
/environment/cache/images/0_0_productGfx_8e56ac496843f9ac0fb7654d2b8a4be6.webp

For the absolute path, link will contain the current protocol.

{{ productImage.webpUrl.absolute }}
https://example.com/userdata/public/gfx/8e56ac496843f9ac0fb7654d2b8a4be6.webp

thumbnailUrl(int width = 0, int height = 0) property

{{ productImage.thumbnailUrl(150,150) }}
/environment/cache/images/150_150_productGfx_8e56ac496843f9ac0fb7654d2b8a4be6.jpg

webpThumbnailUrl(int width = 0, int height = 0) property

{{ productImage.webpThumbnailUrl(50,50) }}
/environment/cache/images/50_50_productGfx_1d8d2f07189da37de919102f3f41e655.webp

isPlaceholder property

{{ productImage.isPlaceholder }}
/userdata/public/gfx/__overlay.jpg
/environment/cache/images/0_0_productGfx___overlay.jpg

We will get the same url format for getWebpUrl() and getWebpThumbnailUrl() methods with proper webp extension.

isFeatured property

{{ productImage.isFeatured }}
true