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¶
name
property¶
extension
property¶
url
property¶
For the absolute path, link will contain the current protocol.
webpUrl
property¶
For the absolute path, link will contain the current protocol.
thumbnailUrl(int width = 0, int height = 0)
property¶
webpThumbnailUrl(int width = 0, int height = 0)
property¶
isPlaceholder
property¶
We will get the same url format for getWebpUrl() and getWebpThumbnailUrl() methods with proper webp extension.