问题描述
我正在尝试从发布的数据中将MP3添加到wordpress媒体库中。以下代码有效,但是MP3没有ID3元数据(艺术家,专辑等)。从媒体库下载MP3并重新上传确实会在媒体库中显示元数据,因此元数据肯定在文件中。
$file = base64_decode($_POST['file']);
$upload_file = wp_upload_bits( basename($file),null,file_get_contents($file) ); //Upload the File
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype( basename($file),null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],'post_title' => base64_decode($_POST['title']),'post_parent' => $_POST['post'],'post_content' => '','post_status' => 'inherit'
); //Set Attachment Arguments
$attachment_id = wp_insert_attachment( $attachment,$upload_file['file'],$_POST['post'] ); // Create the Attachment
set_post_thumbnail( $attachment_id,$_POST['albumart'] ); //Set the Album Artwork
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)