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); }
/** * undocumented function * * @return void * @author Andy Bennett */ public function video_get() { $v = Input::instance()->get('video', false); $p = Input::instance()->get('picture', false); $path = DOCROOT . 'staticfiles/video/'; if ($v === false or !file_exists($path . $v)) { Kohana::show_404($v, 'common/error_404'); } $data['path'] = url::base() . 'staticfiles/video/'; $data['name'] = $v; if ($p !== false) { $data['picture'] = '/staticfiles/img/' . $p; } $data['dimensions'] = ffmpeg::get_video_dimensions($path . $v); Assets::instance()->add_css('/cache/css/ffmpeg'); $c = View::factory('videoplayer', $data)->render(); Display::instance()->display($c); }