本文整理汇总了PHP中wp_add_id3_tag_data函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_add_id3_tag_data函数的具体用法?PHP wp_add_id3_tag_data怎么用?PHP wp_add_id3_tag_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_add_id3_tag_data函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_read_audio_metadata
/**
* Retrieve metadata from a audio file's ID3 tags
*
* @since 3.6.0
*
* @param string $file Path to file.
* @return array|boolean Returns array of metadata, if found.
*/
function wp_read_audio_metadata($file)
{
if (!file_exists($file)) {
return false;
}
$metadata = array();
if (!class_exists('getID3')) {
require ABSPATH . WPINC . '/ID3/getid3.php';
}
$id3 = new getID3();
$data = $id3->analyze($file);
if (!empty($data['audio'])) {
unset($data['audio']['streams']);
$metadata = $data['audio'];
}
if (!empty($data['fileformat'])) {
$metadata['fileformat'] = $data['fileformat'];
}
if (!empty($data['filesize'])) {
$metadata['filesize'] = (int) $data['filesize'];
}
if (!empty($data['mime_type'])) {
$metadata['mime_type'] = $data['mime_type'];
}
if (!empty($data['playtime_seconds'])) {
$metadata['length'] = (int) round($data['playtime_seconds']);
}
if (!empty($data['playtime_string'])) {
$metadata['length_formatted'] = $data['playtime_string'];
}
wp_add_id3_tag_data($metadata, $data);
return $metadata;
}
示例2: wp_read_audio_metadata
/**
* Retrieve metadata from a audio file's ID3 tags
*
* @since 3.6.0
*
* @param string $file Path to file.
* @return array|bool Returns array of metadata, if found.
*/
function wp_read_audio_metadata($file)
{
if (!file_exists($file)) {
return false;
}
$metadata = array();
if (!defined('GETID3_TEMP_DIR')) {
define('GETID3_TEMP_DIR', get_temp_dir());
}
if (!class_exists('getID3', false)) {
require '/usr/share/php/getid3/getid3.php';
}
$id3 = new getID3();
$data = $id3->analyze($file);
if (!empty($data['audio'])) {
unset($data['audio']['streams']);
$metadata = $data['audio'];
}
if (!empty($data['fileformat'])) {
$metadata['fileformat'] = $data['fileformat'];
}
if (!empty($data['filesize'])) {
$metadata['filesize'] = (int) $data['filesize'];
}
if (!empty($data['mime_type'])) {
$metadata['mime_type'] = $data['mime_type'];
}
if (!empty($data['playtime_seconds'])) {
$metadata['length'] = (int) round($data['playtime_seconds']);
}
if (!empty($data['playtime_string'])) {
$metadata['length_formatted'] = $data['playtime_string'];
}
wp_add_id3_tag_data($metadata, $data);
return $metadata;
}