Jump to content

[SOLVED] ID3 MP3 tag read/write in PHP


s0c0

Recommended Posts

I would like an easy way of reading(writing is a plus) id3 tags. I have googled this and there is no easy way.  PHP.Net has the following site http://us3.php.net/manual/en/ref.id3.php and I see that I have to install PEAR which I have and then install a pecl extension.  I'm not very good with compiling and was wondering if anyone new of a suse yast repository that contains these or at least an RPM?

 

Or perhaps another way of getting id3 tags?

Link to comment
https://forums.phpfreaks.com/topic/37340-solved-id3-mp3-tag-readwrite-in-php/
Share on other sites

Hello s0c0,

I did a search at phpclasses.org for "id3" and found this:

http://www.phpclasses.org/browse/package/2462.html

 

There were some other results as well, but I'm not sure if pear is required or not. When I can't find it on google, I seem to find it there lately. Hope this helps!

 

:)

I'm not sure that this is going to work (this isn't for personal use this is a project/webapp) and furthermore I'm not sure on how to use classes.  I'm sure it's in my php book and I'll research using classes tonight.  If anyone else has ideas please do tell.

I solved this on my own.

 

Go to the id3 project page [ http://getid3.sourceforge.net/ ] and download the latest stable version.  I downloaded version 1.7.7.  Then extract the files contents to your web servers root folder.  The readme contains the rest of the information .  I was able to pick up the syntax quickly by analyzing the PHP scripts in the demo directory.

 

Here's an example piece of code:

 

<? php

require_once('/srv/www/htdocs/getid3/getid3/getid3.php');

 

$getID3 = new getID3;

$filename = "/srv/www/htdocs/Wu-Tang Clan - Cream.mp3";

$ThisFileInfo = $getID3->analyze($filename);

getid3_lib::CopyTagsToComments($ThisFileInfo);

echo @$ThisFileInfo['comments_html']['artist'][0] ."<br/>";

echo @$ThisFileInfo['tags']['id3v2']['title'][0] ."<br/>";

echo @$ThisFileInfo['audio']['bitrate'] ."<br/>"; 

echo @$ThisFileInfo['playtime_string'] ."<br/>";

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.