|
|
@@ -185,34 +185,10 @@ 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 2021.3.18 lqh
|
|
|
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);
|
|
|
|
|
|
$data['shortUrl'] = $img;
|