【发布时间】:2013-12-05 10:52:15
【问题描述】:
如何用php修改MP3图片?
我使用 id3_get
但在演示中找不到更改照片
【问题讨论】:
如何用php修改MP3图片?
我使用 id3_get
但在演示中找不到更改照片
【问题讨论】:
就我而言,我使用作曲家。
composer require james-heinrich/getid3
index.php 文件
<?php
require __DIR__.'/vendor/autoload.php';
$getID3 = new getID3;
$tagwriter = new getid3_writetags;
$tagwriter->filename = './music.mp3';
$tagwriter->tagformats = array('id3v1','id3v2.3');
$tagwriter->overwrite_tags = true;
$tagwriter->remove_other_tags = true;
$tagwriter->tag_encoding = 'UTF-8';
$pictureFile = file_get_contents("logo.png");
$TagData = array(
'title' => array('My Title'),
'artist' => array('My Artist'),
'attached_picture' => array(
array (
'data' => $pictureFile,
'picturetypeid' => 3,
'mime' => 'image/png',
'description' => 'My Picture'
)
)
);
$tagwriter->tag_data = $TagData;
if ($tagwriter->WriteTags()){
return true;
}else{
throw new \Exception(implode(' : ', $tagwriter->errors));
}
?>
【讨论】: