extract id3v2 mp3 file

The place for "I can't figure out how to..." questions.
Post Reply
rogalvil

extract id3v2 mp3 file

Post by rogalvil » Wed May 07, 2003 6:08 pm

this tries but I do not work

Code: Select all

 if (is_array($ThisFileInfo['id3v2'])) {

         echo $ThisFileInfo['id3v2']['title'].'<BR>';
         echo $ThisFileInfo['id3v2']['artist'].'<BR>';
         echo $ThisFileInfo['id3v2']['album'].'<BR>';
		 echo $ThisFileInfo['id3v2']['year'].'<BR>';
		 echo $ThisFileInfo['id3v2']['comment'].'<BR>';
		 echo $ThisFileInfo['id3v2']['genreid'].'<BR>';
		 echo $ThisFileInfo['id3v2']['genre'].'<BR>';
		 echo $ThisFileInfo['id3v2']['track'].'<BR>';
     }

James Heinrich
getID3() v1 developer
Posts: 1477
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Post by James Heinrich » Wed May 07, 2003 11:35 pm

The data from ID3v2 is stored in an array in

$fileinfoarray['id3v2']['comments']['title']

so, for example, the title would be stored in

$fileinfoarray['id3v2']['comments']['title'][0]


This is for ID3v2 data specifically - if you're just looking for the comment data in the file it's strongly recommended to use the generic $fileinfoarray['comments'] array, which will contain the best-available data from any type of comment tag (ID3v2, ID3v1, APE, Vorbis, ASF, RIFF, etc) on any type of file.

For an overview of what type of data is returned for any particular file, the included getid3.demo.check.php file will display in an easy-to-understand way what data is returned and where.

milius.net
User
Posts: 16
Joined: Thu Feb 02, 2006 3:19 pm

Post by milius.net » Thu Feb 02, 2006 6:57 pm

hello,

1. my first post here :D
2. getID3 os very nice software - keep up the good work!

3. I do understand that in:
['id3v2'] =>array()
['comments']=>array()
[<key name>]=>array()

... <key name> can be anything - but how do I read it out completly if I don't know what to look for exactly?

in other words:
what else is there besides track#, artist, album, year, composer?
where is the full list?

James Heinrich
getID3() v1 developer
Posts: 1477
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Post by James Heinrich » Fri Feb 03, 2006 3:12 am

Code: Select all

echo '<pre>';
print_r($fileinfoarray);
//var_dump($fileinfoarray); // an alternate to print_r()
echo '</pre>';

milius.net
User
Posts: 16
Joined: Thu Feb 02, 2006 3:19 pm

Post by milius.net » Fri Feb 03, 2006 9:27 am

thanks, james, that's very nice!

Post Reply