Sunday 15 February 2015

php: Get file information with readdir -


I am using this code's code to get the list of audio files in a directory.

  if ($ handle = opendir ($ directory_url)) {while (false! == ($ entry = readdir ($ handle))) {if ($ entry! = "." & Amp;; & amp; $ Amp; $ Entry! = "..") {$ ext = pathinfo ($ Entry, Pathinfa_exchange); $ Audio_ext = array ('mpeg', 'ogg', 'vow', 'webm', 'mp3'); If (in_array (strtolower ($ ext), $ audio_ext)) {Enamel $ {Ento; }}}}  

I also want to read other related information such as title, album and length of audio track if possible. I searched filesystem functions:

Additional files are stored separately in different file types. .

For example: MP3 uses the "id3" tag to save notifications such as titles, albums, etc.

If you want to read ID3 data, you can do something like this:

   

$ Tag ID3 will be an array of information. The second parameter of the function uses the ID3 version file. You can use the function id3_get_version ("example.mp3") to get the version of ID3 tag for the specific file .

Get more information in official PHP doc


No comments:

Post a Comment