wp_calculate_image_srcset


wp_calculate_image_srcset ( $size_array, $image_src, $image_meta, $attachment_id = 0 )

Parameters:
  • (array) $size_array Array of width and height values in pixels (in that order).
  • (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 to pass to the filter. Default 0.
Returns:
  • (string|bool) 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_get_attachment_image_srcset, _rotate_image_resource, wp_ajax_image_editor, wp_cache_reset

Top Google Results

User discussions

wpseek mobile