wp_calculate_image_srcset
wp_calculate_image_srcset ( $size_array, $image_src, $image_meta, $attachment_id = 0 )
Parameters:- (int[]) size_array { An array of width and height values. @type int $0 The width in pixels. @type int $1 The height in pixels. }
- (string) image_src The 'src' of the image.
- (array) image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
- (int) attachment_id Optional. The image attachment ID. Default 0.
Returns:- (string|false) The 'srcset' attribute value. False on error or when only one source exists.
Defined at: - Introduced in WordPress: 4.4.0
- Deprecated in WordPress: —
Description
A helper function to calculate the image sources to include in a 'srcset' attribute.