1<?php 2///////////////////////////////////////////////////////////////// 3/// getID3() by James Heinrich <info@getid3.org> // 4// available at https://github.com/JamesHeinrich/getID3 // 5// or https://www.getid3.org // 6// or http://getid3.sourceforge.net // 7// // 8// /demo/demo.basic.php - part of getID3() // 9// Sample script showing most basic use of getID3() // 10// see readme.txt for more details // 11// /// 12///////////////////////////////////////////////////////////////// 13 14die('For security reasons, this demo has been disabled. It can be enabled by removing line '.__LINE__.' in demos/'.basename(__FILE__)); 15 16 17// include getID3() library (can be in a different directory if full path is specified) 18require_once('../getid3/getid3.php'); 19 20// Initialize getID3 engine 21$getID3 = new getID3; 22 23// Analyze file and store returned data in $ThisFileInfo 24$ThisFileInfo = $getID3->analyze($filename); 25 26/* 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 30*/ 31$getID3->CopyTagsToComments($ThisFileInfo); 32 33/* 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 41*/ 42 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 47 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>'; 50 51/* if you want to see ALL the output, uncomment this line: */ 52//echo '<pre>'.htmlentities(print_r($ThisFileInfo, true), ENT_SUBSTITUTE).'</pre>'; 53 54 55