简体   繁体   中英

Getting mp3 file metadata

I am a bit new to id3 tags and forgive me for the question is too basic.What's a quick and easy way to get ALL ID3 tags (artist, album, etc.) using php/javascript(client side preffered)?

I used this code but it ends up outputting nothing.

<html>
<body>
<?php
$tag = id3_get_tag( "lolwa.mp3" );
print_r($tag);
?>
</body> 
</html>

I know I have to include the ID3v2 library but am confused how exactly to include it.And will including it sove the problem of getting all ID3 tags like:

  • bitrate
  • comments
  • duration etc.

Thanks a lot!

PS- I have included the mp3 file(lolwa.mp3) just next to my code(in the same folder).

PPS- Giving the absolute path of the mp3 file ( file:///C:/wamp/www/php/lolwa.mp3 in my case ) does not work either!

You have to give the absolute path for getting mp3 data using id3_get_tag() function.

<?php
    $tag = id3_get_tag($_SERVER['HTTP_REFERER'].'lolwa.mp3'); 
    print_r($tag);
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM