Commit 307efd56f596a196bccaee6a9d102a9e50570326

Authored by u123231312
1 parent 93cb9343

no message

@@ -50,18 +50,8 @@ class UpFiles extends Common @@ -50,18 +50,8 @@ class UpFiles extends Common
50 chmod($uploadFolder,0777); 50 chmod($uploadFolder,0777);
51 } 51 }
52 $imgPath = $uploadFolder . $name . $ext; 52 $imgPath = $uploadFolder . $name . $ext;
53 - if($obj['size']> 122880){  
54 - $image = new Compression($imgPath);  
55 - $imgPath = $image->getThumb();  
56 - }  
57 //移动到临时目录 53 //移动到临时目录
58 if (move_uploaded_file($tmpName, $imgPath)) { 54 if (move_uploaded_file($tmpName, $imgPath)) {
59 - /*if(filesize($imgPath)> 122880){  
60 - $result['code'] =0;  
61 - $result['info'] = "图片超出125KB";  
62 - $result['url'] = '';  
63 - return $result;  
64 - }*/  
65 $accessKey = 'uva-aaonM8dukeR6phc9yuPBrOXk9brrNW_PxLD7'; 55 $accessKey = 'uva-aaonM8dukeR6phc9yuPBrOXk9brrNW_PxLD7';
66 $secretKey = 'oZMMVN6phk49lG0J1xwmi1Ju0ETT15EnAEWcU9Cs'; 56 $secretKey = 'oZMMVN6phk49lG0J1xwmi1Ju0ETT15EnAEWcU9Cs';
67 $auth = new Auth($accessKey, $secretKey); 57 $auth = new Auth($accessKey, $secretKey);
@@ -72,7 +62,9 @@ class UpFiles extends Common @@ -72,7 +62,9 @@ class UpFiles extends Common
72 // 构建 UploadManager 对象 62 // 构建 UploadManager 对象
73 $uploadMgr = new UploadManager(); 63 $uploadMgr = new UploadManager();
74 $backUrl = "pe9jzv1q9.bkt.clouddn.com"; //返回图片在七牛的路径 64 $backUrl = "pe9jzv1q9.bkt.clouddn.com"; //返回图片在七牛的路径
75 - list($ret, $err) = $uploadMgr->putFile($token,$key,$imgPath); 65 + $image = new Compression($imgPath);
  66 + $imgPath = $image->getThumb();
  67 + list($ret, $err) = $uploadMgr->putFile($token,$key,$imgPath); //缩略图
76 // 获取视频的时长 68 // 获取视频的时长
77 // 第一步先获取到到的是关于视频所有信息的json字符串 69 // 第一步先获取到到的是关于视频所有信息的json字符串
78 //$shichang = file_get_contents('http://'.WAILIAN.$key.'?avinfo'); 70 //$shichang = file_get_contents('http://'.WAILIAN.$key.'?avinfo');
@@ -98,7 +90,7 @@ class UpFiles extends Common @@ -98,7 +90,7 @@ class UpFiles extends Common
98 } 90 }
99 if($rs['url']){ 91 if($rs['url']){
100 //上传成功之后删除服务器文件 92 //上传成功之后删除服务器文件
101 - unlink($imgPath); 93 + $this->deldir($uploadFolder);
102 $result['code'] = 1; 94 $result['code'] = 1;
103 $result['info'] = '图片上传成功!'; 95 $result['info'] = '图片上传成功!';
104 $path=str_replace('\\','/',$rs['url']); 96 $path=str_replace('\\','/',$rs['url']);
@@ -114,6 +106,9 @@ class UpFiles extends Common @@ -114,6 +106,9 @@ class UpFiles extends Common
114 return $result; 106 return $result;
115 } 107 }
116 } 108 }
  109 + public function deldir($dirName) {
  110 + array_map('unlink', glob($dirName."*.*"));
  111 + }
117 112
118 public function file(){ 113 public function file(){
119 $fileKey = array_keys(request()->file()); 114 $fileKey = array_keys(request()->file());