AS PHP MP3 length


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //PHP
  2. <?php
  3. function magicFunction($file){
  4. //get the $length
  5. require_once('getid3.php');
  6. $getID3 = new getID3;
  7. $ThisFileInfo = $getID3->analyze($file);
  8. $length = $ThisFileInfo['playtime_string'];// or playtime_seconds that is preformatted
  9. echo "source=\"".$file."\" length=\"".$length."\" ";
  10. }
  11. ?>
  12.  
  13. //XML
  14.  
  15. <mp3 <?php magicFunction("some.mp3"); ?> />

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.