Esempio n. 1
25
 public function generate_preview(&$upload_data, $filename, $ext)
 {
     $upload_data['duration'] = file_exists($filename) ? ffmpeg::get_mpeg_length($filename) : null;
     $upload_data['is_audio'] = 1;
     $icon = $this->generate_icon($ext);
     ffmpeg::audio_mp3($filename);
     $upload_data['preview'] = $this->save_preview($upload_data, $icon);
 }
Esempio n. 2
1
 public function generate_preview(&$upload_data, $filename, $ext)
 {
     $upload_data['duration'] = file_exists($filename) ? ffmpeg::get_mpeg_length($filename) : null;
     $upload_data['is_video'] = 1;
     $dimensions = file_exists($filename) ? ffmpeg::get_video_dimensions($filename) : array('height' => null, 'width' => null);
     $upload_data['image_width'] = $dimensions['width'];
     $upload_data['image_height'] = $dimensions['height'];
     $upload_data['image_size_str'] = 'width="' . $dimensions['width'] . '" height="' . $dimensions['height'] . '"';
     //create thumbnail
     $s = ffmpeg::duration_to_seconds($upload_data['duration']);
     $s = $s / 2;
     $d = ffmpeg::seconds_to_duration($s) . ".1";
     //create thumbnail
     ffmpeg::extract_frame($filename, $d);
     $fn = substr($filename, 0, strrpos($filename, '.')) . '.jpg';
     $upload_data['preview'] = $this->save_preview($upload_data, $fn);
 }