public function doPageuploadDakaVideo(){
global $_GPC, $_W;
load()->func('file');
$filename = file_upload($_FILES['dakavideo'], 'video');
$new_thumb_name = preg_replace('/(.*\.)(.*)/', '${1}jpg', $filename['path']);
$this->getThumb(IA_ROOT.'/attachment/',$filename['path'],$new_thumb_name);
$temp = getimagesize(IA_ROOT.'/attachment/'.$new_thumb_name);
file_remote_upload($filename['path']);
file_remote_upload($new_thumb_name);
$ret = [
'romoteVideoSrc' => $filename['path'],
'romoteVideoThumbSrc' => $new_thumb_name,
'oImgWidth' => $temp[0],
'oImgHeight' => $temp[1]
];
return $this->result(0, "doPageuploadDakaVideo",$ret);
}
==================================
//open_basedir=/www/wwwroot/amy..com/:/tmp/:/proc/
private function getThumb($dir , $fileName, $name){
$ffmpeg = FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => '/usr/bin/avconv',
'ffmpeg.binaries' => '/usr/bin/ffmpeg',
'ffprobe.binaries' => '/usr/bin/avprobe',
'ffprobe.binaries' => '/usr/bin/ffprobe',
//'timeout' => 3600, // The timeout for the underlying process
//'ffmpeg.threads' => 12, // The number of threads that FFMpeg should use
]);
$video = $ffmpeg->open($dir . $fileName);
$thumbFile = $dir . $name;
$video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(1))->save($thumbFile);
return;
}
网友评论