title: Extracting metadata of a file using php
body: <p>There are many file formats nowadays(audio,video,image,text).I wish to write a php code that can get me the metadata of the file irrespective of its format.</p>
  
  <p>To get the basic metadata(filename,filesize,filetype and last modified date),one may use the filesystem API:</p>
  
  <pre><code>&lt;input type="file" id="files" name="files[]" multiple /&gt;
  &lt;output id="list"&gt;&lt;/output&gt;
  
  &lt;script&gt;
    function handleFileSelect(evt) {
      var files = evt.target.files; // FileList object
  
      // files is a FileList of File objects. List some properties.
      var output = [];
      for (var i = 0, f; f = files[i]; i++) {
      output.push('&lt;li&gt;&lt;strong&gt;', escape(f.name), '&lt;/strong&gt; (', f.type || 'n/a', ') - ',
                   f.size, ' bytes, last modified: ',
                   f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
                   '&lt;/li&gt;');
      }
      document.getElementById('list').innerHTML = '&lt;ul&gt;' + output.join('') + '&lt;/ul&gt;';
    }
    document.getElementById('files').addEventListener('change', handleFileSelect, false);
  &lt;/script&gt;
  </code></pre>
  
  <p>But,I wish to extract <strong>every damn possible thing</strong> I can manage to extract from the file(every possible metadata).</p>
  
  <p>Ex: For a jpg image,on extracting its metadata,i get(using exif tags):</p>
  
  <pre><code>FILE.FileName: idfo1.jpg 
  FILE.FileDateTime: 1369637595 
  FILE.FileSize: 126948 
  FILE.FileType: 2  
  FILE.MimeType: image/jpeg 
  FILE.SectionsFound: ANY_TAG, IFD0, EXIF 
  COMPUTED.html: width="915" height="1246" 
  COMPUTED.Height: 1246 
  COMPUTED.Width: 915 
  COMPUTED.IsColor: 1 
  COMPUTED.ByteOrderMotorola: 1 
  COMPUTED.ApertureFNumber: f/2.6 
  COMPUTED.UserComment:  
  IFD0.ImageWidth: 2048 
  IFD0.ImageLength: 1536 
  IFD0.Make: SAMSUNG 
  IFD0.Model: GT-S5830 
  IFD0.Software: S5830DXKPD 
  IFD0.DateTime: 2012:06:06 10:18:24 
  IFD0.YCbCrPositioning: 1 
  IFD0.Exif_IFD_Pointer: 2232 
  IFD0.UndefinedTag:0xEA1C: ê 
  EXIF.ExposureTime: 1/229 
  EXIF.FNumber: 26/10 
  EXIF.ExposureProgram: 3 
  EXIF.ISOSpeedRatings: 50 
  EXIF.ExifVersion: 0220 
  EXIF.DateTimeOriginal: 2012:06:06 10:18:24 
  EXIF.DateTimeDigitized: 2012:06:06 10:18:24    
  EXIF.MaxApertureValue: 30/10 
  EXIF.MeteringMode: 3 
  EXIF.Flash: 0 
  EXIF.FocalLength: 355/100 
  EXIF.UserComment:  
  EXIF.ColorSpace: 1 
  EXIF.ExifImageWidth: 2048 
  EXIF.ExifImageLength: 1536 
  EXIF.ExposureMode: 0 
  EXIF.WhiteBalance: 0 
  EXIF.SceneCaptureType: 0 
  EXIF.UndefinedTag:0xEA1C: ê
  </code></pre>
  
  <p>If possible,I wish to get even the geotagging data. </p>
  
  <p>Similarly,for video and audio type files,I wish to get the:</p>
  
  <ul>
  <li>Bitrates(Audio and Video)</li>
  <li>Duration</li>
  <li>File Create Date</li>
  <li>Comments</li>
  <li>Frame Dimensions etc.</li>
  </ul>
  
  <p>Is there any <strong>php</strong> or <strong>javascript</strong> code which can do this directly for me? </p>