a few words about web development

How to read ID3 tags from MP3 files?

Versatile and buletproof way to get information from MP3 songs
Here are 2 simple classes to read ID3v1 and ID3v2 with PHP:
Reading ID3 v1
Reading ID3 v2

And here is a solution which should be more versatile, using external program id3tool:
$fname = 'Woozy.mp3';

$res = $out = array();
exec('id3tool "' . $fname . '"', $out);

unset($out[0]);
foreach ($out AS $o)
{
	$temp = explode("\t", $o);
	if (!isset($temp[1])) continue;
	$res[rtrim($temp[0], ':')] = trim($temp[count($temp)-1]);
}

print_r($res);


Comments