|
...
|
...
|
@@ -50,18 +50,8 @@ class UpFiles extends Common |
|
|
|
chmod($uploadFolder,0777);
|
|
|
|
}
|
|
|
|
$imgPath = $uploadFolder . $name . $ext;
|
|
|
|
if($obj['size']> 122880){
|
|
|
|
$image = new Compression($imgPath);
|
|
|
|
$imgPath = $image->getThumb();
|
|
|
|
}
|
|
|
|
//移动到临时目录
|
|
|
|
if (move_uploaded_file($tmpName, $imgPath)) {
|
|
|
|
/*if(filesize($imgPath)> 122880){
|
|
|
|
$result['code'] =0;
|
|
|
|
$result['info'] = "图片超出125KB";
|
|
|
|
$result['url'] = '';
|
|
|
|
return $result;
|
|
|
|
}*/
|
|
|
|
$accessKey = 'uva-aaonM8dukeR6phc9yuPBrOXk9brrNW_PxLD7';
|
|
|
|
$secretKey = 'oZMMVN6phk49lG0J1xwmi1Ju0ETT15EnAEWcU9Cs';
|
|
|
|
$auth = new Auth($accessKey, $secretKey);
|
|
...
|
...
|
@@ -72,7 +62,9 @@ class UpFiles extends Common |
|
|
|
// 构建 UploadManager 对象
|
|
|
|
$uploadMgr = new UploadManager();
|
|
|
|
$backUrl = "pe9jzv1q9.bkt.clouddn.com"; //返回图片在七牛的路径
|
|
|
|
list($ret, $err) = $uploadMgr->putFile($token,$key,$imgPath);
|
|
|
|
$image = new Compression($imgPath);
|
|
|
|
$imgPath = $image->getThumb();
|
|
|
|
list($ret, $err) = $uploadMgr->putFile($token,$key,$imgPath); //缩略图
|
|
|
|
// 获取视频的时长
|
|
|
|
// 第一步先获取到到的是关于视频所有信息的json字符串
|
|
|
|
//$shichang = file_get_contents('http://'.WAILIAN.$key.'?avinfo');
|
|
...
|
...
|
@@ -98,7 +90,7 @@ class UpFiles extends Common |
|
|
|
}
|
|
|
|
if($rs['url']){
|
|
|
|
//上传成功之后删除服务器文件
|
|
|
|
unlink($imgPath);
|
|
|
|
$this->deldir($uploadFolder);
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['info'] = '图片上传成功!';
|
|
|
|
$path=str_replace('\\','/',$rs['url']);
|
|
...
|
...
|
@@ -114,6 +106,9 @@ class UpFiles extends Common |
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function deldir($dirName) {
|
|
|
|
array_map('unlink', glob($dirName."*.*"));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function file(){
|
|
|
|
$fileKey = array_keys(request()->file());
|
...
|
...
|
|