2 /////////////////////////////////////////////////////////////////
3 /// getID3() by James Heinrich <info@getid3.org> //
4 // available at http://getid3.sourceforge.net //
5 // or http://www.getid3.org //
6 // also https://github.com/JamesHeinrich/getID3 //
7 /////////////////////////////////////////////////////////////////
9 // /demo/demo.basic.php - part of getID3() //
10 // Sample script showing most basic use of getID3() //
11 // See readme.txt for more details //
13 /////////////////////////////////////////////////////////////////
15 die('Due to a security issue, this demo has been disabled. It can be enabled by removing line '.__LINE__.' in '.$_SERVER['PHP_SELF']);
17 // include getID3() library (can be in a different directory if full path is specified)
18 require_once('../getid3/getid3.php');
20 // Initialize getID3 engine
23 // Analyze file and store returned data in $ThisFileInfo
24 $ThisFileInfo = $getID3->analyze($filename);
27 Optional: copies data from all subarrays of [tags] into [comments] so
28 metadata is all available in one location for all tag formats
29 metainformation is always available under [tags] even if this is not called
31 getid3_lib::CopyTagsToComments($ThisFileInfo);
34 Output desired information in whatever format you want
35 Note: all entries in [comments] or [tags] are arrays of strings
36 See structure.txt for information on what information is available where
37 or check out the output of /demos/demo.browse.php for a particular file
38 to see the full detail of what information is returned where in the array
39 Note: all array keys may not always exist, you may want to check with isset()
40 or empty() before deciding what to output
43 //echo $ThisFileInfo['comments_html']['artist'][0]; // artist from any/all available tag formats
44 //echo $ThisFileInfo['tags']['id3v2']['title'][0]; // title from ID3v2
45 //echo $ThisFileInfo['audio']['bitrate']; // audio bitrate
46 //echo $ThisFileInfo['playtime_string']; // playtime in minutes:seconds, formatted string
48 /* if you want to see all the tag data (from all tag formats), uncomment this line: */
49 //echo '<pre>'.htmlentities(print_r($ThisFileInfo['comments'], true), ENT_SUBSTITUTE).'</pre>';
51 /* if you want to see ALL the output, uncomment this line: */
52 //echo '<pre>'.htmlentities(print_r($ThisFileInfo, true), ENT_SUBSTITUTE).'</pre>';