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:

Description

A helper function to calculate the image sources to include in a 'srcset' attribute.

Related Functions

wp_calculate_image_sizes, wp_create_image_subsizes, wp_get_attachment_image_srcset, wp_update_image_subsizes, wp_ajax_image_editor

Top Google Results

User discussions

wpseek mobile