note 91116 deleted from id3v2attachedpictureframe.setPicture by danbrown
| From: | danbrown@php.net | Date: | Tue, 26 May 2009 13:00:30 +0000 |
| Subject: | note 91116 deleted from id3v2attachedpictureframe.setPicture by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156022@lists.php.net to get a copy of this message | ||
Note Submitter: maceo dot park at gmail dot com
----
<?php
$path = realpath('.');
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path),
RecursiveIteratorIterator::SELF_FIRST);
foreach($objects as $name => $object){
if(strpos($name, ".mp3") !== false) {
$mp3 = new KTaglib_MPEG_File($name);
$frameList = $mp3->getID3v2Tag()->getFrameList();
echo $name . "\n";
print_r($frameList);
$pic_frame = new KTaglib_ID3v2_AttachedPictureFrame();
$pic_frame->setMimeType("image/jpeg");
$pic_frame->setType(3); // front_cover. refer to taglib source code.
/taglib-1.5/taglib/mpeg/id3v2/frames/attachedpictureframe.h
$pic_frame->setPicture("SamplePicture.jpg");
$mp3->getID3v2Tag()->addFrame($pic_frame);
$mp3->save();
}
}
?>