时间:2024-03-12
WordPress函数wp_get_attachment_metadata用于获取附件的元数据,例如图像的宽高、缩略图版本等。
wp_get_attachment_metadata( int $attachment_id, bool $unfiltered = false )
$attachment_id
整数
附件的ID
$unfiltered
布尔值,默认值:false
是否运行过滤器。
Array ( [width] => 768 [height] => 430 [file] => 2020/05/baidusrf-for-linux.webp [sizes] => Array ( [thumbnail] => Array ( [file] => baidusrf-for-linux-320x200.jpg [width] => 320 [height] => 200 [mime-type] => image/webp ) ) [image_meta] => Array ( [aperture] => 0 [credit] => [camera] => [caption] => [created_timestamp] => 0 [copyright] => [focal_length] => 0 [iso] => 0 [shutter_speed] => 0 [title] => [orientation] => 0 [keywords] => Array ( ) ) )
wp_get_attachment_metadata()函数位于:wp-includes/post.php
相关函数:
get_post_meta()
wp_get_attachment_image_src()
wp_get_attachment_image_url()
wp_get_attachment_image_sizes()
wp_get_attachment_image_srcset()
wp_get_attachment_image_attributes()
Copyright © 2019-2024 mysql.hk