Ver Fonte

图片上传

shish há 4 anos atrás
pai
commit
95736d3db5
1 ficheiros alterados com 0 adições e 34 exclusões
  1. 0 34
      app-ghs/controllers/UploadController.php

+ 0 - 34
app-ghs/controllers/UploadController.php

@@ -84,45 +84,11 @@ class UploadController extends BaseController
                 util::fail('上传失败!!');
             }
             $img = "uploads/{$sjId}/{$month}/{$date}/" . $newFile;
-            $imgInfo = getimagesize($fullPathFile);
-            $width = $imgInfo[0];
-            $height = $imgInfo[1];
-
-            //如果图片太大,进行压缩,并删除原图
-            if ($width > 800) {
-                $newWidth = 800;
-                $newHeight = ceil((800 * $height) / $width);
-                $preFileName = stringUtil::uniqueFileName();
-                $newFile = $preFileName . ".{$type}";
-                $newFullPathFile = $path . $newFile;
-                Image::thumbnail($fullPathFile, $newWidth, $newHeight)->save($newFullPathFile, ['quality' => 100]);
-                $width = $newWidth;
-                $height = $newHeight;
-                $img = "uploads/{$sjId}/{$month}/{$date}/" . $newFile;
-                unlink($fullPathFile);
-                $fullPathFile = $newFullPathFile;
-            }
 
             oss::uploadImage($img, $fullPathFile);
-            //生成小图 200px
-            //$smallWidth = 200;
-            //$smallHeight = ceil((200 * $height) / $width);
-            //$smallFullPathFile = $path . $preFileName . '_small.' . $type;
-            //Image::thumbnail($fullPathFile, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
 
             $data = business::formatUploadImg($img);
 
-//			if (!empty($categoryIds)) {
-//				$time = time();
-//				$data = ['img' => $img, 'sjId' => $sjId, 'name' => '未命名', 'addTime' => $time];
-//				$pic = PicService::add($data);
-//				$currentId = $pic['id'];
-//				$add = [];
-//				foreach ($categoryIds as $cat) {
-//					$add[] = ['categoryId' => $cat, 'picId' => $currentId, 'sjId' => $this->sjId];
-//				}
-//				PicCategoryService::batchAdd($add);
-//			}
             $data['shortUrl'] = $img;
             $data['smallShortUrl'] = $img . "?x-oss-process=image/resize,l_200";
             util::success($data);