wp_get_attachment_image_src


wp_get_attachment_image_src ( $attachment_id, $size = 'thumbnail', $icon = false )

Parameters:
  • (int) $attachment_id Image attachment ID.
  • (string|array) $size Optional. Image size. Accepts any valid image size, or an array of width and height values in pixels (in that order). Default 'thumbnail'.
  • (bool) $icon Optional. Whether the image should be treated as an icon. Default false.
Returns:
  • (false|array) Returns an array (url, width, height, is_intermediate), or false, if no image is available.
Defined at:

Description

Retrieve an image to represent an attachment.

A mime icon for files, thumbnail or intermediate size for images.

The returned array contains four values: the URL of the attachment image src, the width of the image file, the height of the image file, and a boolean representing whether the returned array describes an intermediate (generated) image size or the original, full-sized upload.

Related Functions

wp_get_attachment_image_srcset, wp_get_attachment_image_url, wp_get_attachment_image, wp_get_attachment_image_sizes, get_attachment_icon_src

Top Google Results

User discussions

wpseek mobile