Namespace: ImageHelpers

ImageHelpers

Methods

(static) imageForSize(image, options) → {String}

Generates the image src for a resized image with maximum dimensions maxWidth and maxHeight. Images do not scale up.

Parameters:
Name Type Description
image Object

The original image model to generate the image src for.

options Object

An options object containing:

Properties
Name Type Description
maxWidth Integer

The maximum width for the image.

maxHeight Integer

The maximum height for the image.

Source:
Returns:

The image src for the resized image.

Type
String
Example
const url = client.image.imageForSize(product.variants[0].image, {maxWidth: 50, maxHeight: 50});