...
|
...
|
@@ -53,14 +53,42 @@ class Index extends Frontend |
|
|
//文件详情
|
|
|
public function detail()
|
|
|
{
|
|
|
$qiniu = get_addon_config('qiniu')['cdnurl'];
|
|
|
$user_id = $this->request->param('user_id');
|
|
|
$file_id = $this->request->param('file_id');
|
|
|
|
|
|
$data = Db::name('savemes')
|
|
|
->where('id',$file_id)
|
|
|
->find();
|
|
|
|
|
|
|
|
|
if($data['type'] == 2){
|
|
|
$data['video'] = '';
|
|
|
$data['video_image'] = '';
|
|
|
$data['content'] = '';
|
|
|
$data['images'] = $qiniu.$data['images'];
|
|
|
}elseif ($data['type'] == 3){
|
|
|
$data['images'] = '';
|
|
|
$data['content'] = '';
|
|
|
$data['video'] = $qiniu.$data['video'];
|
|
|
// 获取视频第一帧图片
|
|
|
$video_info = json_decode(file_get_contents($data['video'] . '?avinfo'), true);
|
|
|
$data['video_image'] = $this->get_video_first_image($data['video'], $video_info);
|
|
|
}elseif ($data['type'] == 1){
|
|
|
$data['images'] = '';
|
|
|
$data['video'] = '';
|
|
|
$data['video_image'] = '';
|
|
|
}
|
|
|
$this->assign('data',$data);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
public function get_video_first_image($video_url,$video_info){
|
|
|
if(empty($video_info['streams'][0]['width'])) {
|
|
|
$width = $video_info['streams'][1]['width'];
|
|
|
$height = $video_info['streams'][1]['height'];
|
|
|
} else {
|
|
|
$width = $video_info['streams'][0]['width'];
|
|
|
$height = $video_info['streams'][0]['height'];
|
|
|
}
|
|
|
return $video_url.'?vframe/jpg/offset/1/w/'.$width.'/h/'.$height;
|
|
|
}
|
|
|
} |
...
|
...
|
|