Wocart

@wocart/storefront v3.1.0


@wocart/storefront / index / mediaImageSrcset

Function: mediaImageSrcset()

mediaImageSrcset(src, widths, options): string

The same photo at several widths, with width descriptors (… 360w, … 720w), for an <img> whose sizes says how wide it shows — a phone then downloads a phone-sized file, in the best format it takes.

Parameters

src

string

widths

readonly number[]

options

MediaImageSrcsetOptions

Returns

string

null when the photo cannot be resized (see mediaImageUrl) or no width is a positive whole number.