本文整理匯總了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;
}