_wp_get_image_size_from_meta
函数
_wp_get_image_size_from_meta ( $size_name, $image_meta )
- Access
- Private
- 参数
-
-
(string)
$size_name
Image size. Accepts any registered image size name.- Required: 是
-
(array)
$image_meta
The image meta data.- Required: 是
-
(string)
- 返回值
-
- (array|false) { Array of width and height or false if the size isn’t present in the meta data. @type int $0 Image width. @type int $1 Image height. }
- 定义位置
-
-
wp-includes/media.php
, line 1182
-
wp-includes/media.php
- 引入
- 4.4.0
- 弃用
- –
Gets the image size as array from its meta data.
Used for responsive images.
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; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。