wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_get_media_creation_timestamp › WordPress Function
Since4.9.0
已弃用n/a
› wp_get_media_creation_timestamp ( $metadata )
参数: |
|
链接: | |
返回: |
|
定义在: |
|
文档: |
Parses creation date from media metadata.
The getID3 library doesn't have a standard method for getting creation dates, so the location of this data can vary based on the MIME type.Related Functions: get_media_item, get_media_items, wp_ajax_media_create_image_subsizes, get_post_timestamp, wp_kses_named_entities
源码
function wp_get_media_creation_timestamp( $metadata ) { $creation_date = false; if ( empty( $metadata['fileformat'] ) ) { return $creation_date; } switch ( $metadata['fileformat'] ) { case 'asf': if ( isset( $metadata['asf']['file_properties_object']['creation_date_unix'] ) ) { $creation_date = (int) $metadata['asf']['file_properties_object']['creation_date_unix']; } break; case 'matroska': case 'webm': if ( isset( $metadata['matroska']['comments']['creation_time'][0] ) ) { $creation_date = strtotime( $metadata['matroska']['comments']['creation_time'][0] ); } elseif ( isset( $metadata['matroska']['info'][0]['DateUTC_unix'] ) ) { $creation_date = (int) $metadata['matroska']['info'][0]['DateUTC_unix']; } break; case 'quicktime': case 'mp4': if ( isset( $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'] ) ) { $creation_date = (int) $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix']; } break; } return $creation_date; }