Media: Ensure a consistent structure for the array returned by wp_get_attachment_image_src()
.
The array returned by this function previously included a fourth element only when an intermediate image size was used. This change ensures a consistent structure in the returned array regardless of the function's internal behaviour. Props wido, joemcgill, johnbillion Fixes #46113 git-svn-id: https://develop.svn.wordpress.org/trunk@47748 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4889e7a8d2
commit
84772cc608
@ -947,6 +947,7 @@ function wp_get_registered_image_subsizes() {
|
|||||||
* @type string $0 Image source URL.
|
* @type string $0 Image source URL.
|
||||||
* @type int $1 Image width in pixels.
|
* @type int $1 Image width in pixels.
|
||||||
* @type int $2 Image height in pixels.
|
* @type int $2 Image height in pixels.
|
||||||
|
* @type bool $3 Whether the image is a resized image.
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
|
function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
|
||||||
@ -968,7 +969,7 @@ function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $src && $width && $height ) {
|
if ( $src && $width && $height ) {
|
||||||
$image = array( $src, $width, $height );
|
$image = array( $src, $width, $height, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -982,6 +983,7 @@ function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon
|
|||||||
* @type string $0 Image source URL.
|
* @type string $0 Image source URL.
|
||||||
* @type int $1 Image width in pixels.
|
* @type int $1 Image width in pixels.
|
||||||
* @type int $2 Image height in pixels.
|
* @type int $2 Image height in pixels.
|
||||||
|
* @type bool $3 Whether the image is a resized image.
|
||||||
* }
|
* }
|
||||||
* @param int $attachment_id Image attachment ID.
|
* @param int $attachment_id Image attachment ID.
|
||||||
* @param string|int[] $size Requested size of image. Image size name, or array of width
|
* @param string|int[] $size Requested size of image. Image size name, or array of width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user