This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
_wp_get_image_size_from_meta( string $size_name, array $image_meta )
Get the image size as array from its meta data.
Description
Used for responsive images.
Parameters
- $size_name
-
(Required) Image size. Accepts any valid image size name ('thumbnail', 'medium', etc.).
- $image_meta
-
(Required) The image meta data.
Return
(array|bool) Array of width and height values in pixels (in that order) or false if the size doesn't exist.
Source
File: wp-includes/media.php
function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
if ( $size_name === 'full' ) {
return array(
absint( $image_meta['width'] ),
absint( $image_meta['height'] ),
);
} elseif ( ! empty( $image_meta['sizes'][$size_name] ) ) {
return array(
absint( $image_meta['sizes'][$size_name]['width'] ),
absint( $image_meta['sizes'][$size_name]['height'] ),
);
}
return false;
}
Changelog
Version | Description |
---|---|
WP-4.4.0 | Introduced. |