wp_calculate_image_sizes


wp_calculate_image_sizes ( $size, $image_src = null, $image_meta = null, $attachment_id = 0 )

Parameters:
  • (string|int[]) size Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order).
  • (string|null) image_src Optional. The URL to the image file. Default null.
  • (array|null) image_meta Optional. The image meta data as returned by 'wp_get_attachment_metadata()'. Default null.
  • (int) attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id` is needed when using the image size name as argument for `$size`. Default 0.
Returns:
  • (string|false) A valid source size value for use in a 'sizes' attribute or false.
Defined at:

Description

Creates a 'sizes' attribute value for an image.

Related Functions

wp_calculate_image_srcset, wp_update_image_subsizes, wp_create_image_subsizes, wp_ajax_media_create_image_subsizes, wp_get_attachment_image_sizes

Top Google Results

User discussions

wpseek mobile