Uses
Uses | Description |
---|---|
wp-includes/functions.php: absint() | Convert a value to non-negative integer. |
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.
Get the image size as array from its meta data.
Used for responsive images.
(string) (Required) Image size. Accepts any valid image size name ('thumbnail', 'medium', etc.).
(array) (Required) The image meta data.
(array|bool) The image meta data as returned by wp_get_attachment_metadata()
.
File: wp-includes/media.php
function _wp_get_image_size_from_meta( $size_name, $image_meta ) { if ( 'full' === $size_name ) { 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; }
Version | Description |
---|---|
4.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_get_image_size_from_meta