Question

I have a project that I want the user to input the path (folder only) where the mp3 files are located. The php script will input all the filename and the getid3 information into database. How do you do that? is it possible?

I found this http://php.net/manual/en/function.readdir.php, but I dont' know how to link it with getid3 together to get the result that I describe above

Can someone show me a sample of how this work and store it in sql database? Thanks

Was it helpful?

Solution

While this is a very broad question I'll try to provide some hints.

//basic use of getid3 returns a massive deep array of values that really sucks to parse
$id3 = new getid3();
$result = $id3->analyze(filename);

//example of access of retruned data
$albumName = $result['id3v2']['comments']['album'][0];
$artist = $result['id3v2']['comments']['artist'][0];

you put this in a database the same way you would any other data

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top