|
|
|
@ -154,10 +154,13 @@ class Upload extends BaseController |
|
|
|
return $data; |
|
|
|
}else{ |
|
|
|
$fileInfo=new FileModel; |
|
|
|
$fileInfo->save($ret); |
|
|
|
$exists = $fileInfo->where($ret)->find(); |
|
|
|
if (!$exists) { |
|
|
|
$fileInfo->save($ret); |
|
|
|
} |
|
|
|
// 上传视频切片 |
|
|
|
if ($fileType == 4) { |
|
|
|
$videoInfo=$this->getVideoCover($filePath); |
|
|
|
$videoInfo=$this->getVideoCover($filePath, true); |
|
|
|
if($videoInfo){ |
|
|
|
$poster=$this->url.$videoInfo['src']; |
|
|
|
}else{ |
|
|
|
@ -346,7 +349,7 @@ class Upload extends BaseController |
|
|
|
} |
|
|
|
|
|
|
|
// 获取视频封面 |
|
|
|
public function getVideoCover($filePath){ |
|
|
|
public function getVideoCover($filePath, $is_save = false){ |
|
|
|
$fileName=pathinfo($filePath,PATHINFO_FILENAME).'.jpg'; |
|
|
|
$ffmpegPath=env('ffmpeg.bin_path',''); |
|
|
|
if(!$ffmpegPath){ |
|
|
|
@ -369,9 +372,12 @@ class Upload extends BaseController |
|
|
|
$info=$this->upload([],$savePath,'cover/'.date('Y-m-d').'/',false); |
|
|
|
$info['videoInfo']['duration']= ceil($duration); |
|
|
|
unlink($savePath); |
|
|
|
if ($info) { |
|
|
|
if ($info && $is_save) { |
|
|
|
$fileInfo=new FileModel; |
|
|
|
$fileInfo->save($info); |
|
|
|
$exists = $fileInfo->where($info)->find(); |
|
|
|
if (!$exists) { |
|
|
|
$fileInfo->save($info); |
|
|
|
} |
|
|
|
} |
|
|
|
return $info; |
|
|
|
} |
|
|
|
|