You are here

function filefield_meta in FileField 5.2

Same name and namespace in other branches
  1. 6.3 filefield_meta/filefield_meta.module \filefield_meta()
  2. 6.2 filefield_meta/filefield_meta.module \filefield_meta()
1 call to filefield_meta()
filefield_meta_filefield in filefield_meta/filefield_meta.module

File

filefield_meta/filefield_meta.module, line 82

Code

function filefield_meta(&$file) {
  $info = getid3_analyze($file['filepath']);
  $file['width'] = $file['height'] = $file['duration'] = 0;
  if (isset($info['video']['resolution_x'])) {
    $file['width'] = $info['video']['resolution_x'];
    $file['height'] = $info['video']['resolution_y'];
  }
  else {
    if (isset($info['video']['streams'])) {
      foreach ($info['video']['streams'] as $stream) {
        $file['width'] = max($file['width'], $stream['resolution_x']);
        $file['height'] = max($file['height'], $stream['resolution_y']);
      }
    }
  }
  $file['duration'] = $info['playtime_seconds'];
}