diff --git a/app/controller/manager/Upload.php b/app/controller/manager/Upload.php index e7f9481..8e1a971 100755 --- a/app/controller/manager/Upload.php +++ b/app/controller/manager/Upload.php @@ -25,7 +25,7 @@ class Upload extends BaseController } $this->validate = new VUpload(); $this->uploadPath = Config::get('filesystem.disks.local.url'); - if(is_writable(app()->getRootPath() . 'wwwroot' . $this->uploadPath)){ + if(is_writable(app()->getRootPath() . 'public' . $this->uploadPath)){ $this->uploadPathIsWritable = 1; } } @@ -48,7 +48,7 @@ class Upload extends BaseController return $this->json(1, $errorMsg); } } - + //文件上传(通用) public function file() { @@ -72,7 +72,7 @@ class Upload extends BaseController return $this->json(1, $errorMsg); } } - + //图片上传(通用) public function image() { @@ -91,9 +91,9 @@ class Upload extends BaseController $return['thumb_src'] = Image::getThumb($src, 100, 100, TImage::THUMB_SCALING); //上传返回缩略图宽度为100 } $return['src'] = $src; - if($this->isCompress){ - Image::resize($src); - } +// if($this->isCompress){ +// Image::resize($src); +// } File::add($image, $src); //加入上传文件表 } catch (\Exception $e) { return $this->json(1, $e->getMessage()); @@ -108,7 +108,7 @@ class Upload extends BaseController //富文本编辑器商城图片 public function wangImage() { - + $imageArr = request()->file('wang_img'); // 该方式,前端js上传方法中字段名称必须以数组形式传参 如 wang_img[] = 值 $errno = 0; $data = []; @@ -133,7 +133,7 @@ class Upload extends BaseController } } } - + $return['errno'] = $errno; $return['data'] = $data; return json($return); diff --git a/app/service/Image.php b/app/service/Image.php index 068be2b..ad03a6a 100755 --- a/app/service/Image.php +++ b/app/service/Image.php @@ -14,7 +14,7 @@ class Image extends File public static function resize($src) { $max = 1920; - $realPath = app()->getRootPath() . 'wwwroot/' . ltrim($src,'/'); + $realPath = app()->getRootPath() . 'public/' . ltrim($src,'/'); if(is_file($realPath)){ $img = TImage::open($realPath); list($img_w,$img_h) = $img->size(); @@ -34,7 +34,7 @@ class Image extends File $rootPath = app()->getRootPath(); if(!empty($src)){ $system = System::getSystem(); - $realPath = $rootPath . 'wwwroot/' . ltrim($src, '/'); + $realPath = $rootPath . 'public/' . ltrim($src, '/'); if(is_file($realPath)){ if($system['is_mark']){ $mark = $rootPath . ltrim($system['mark_img'], '/'); @@ -48,7 +48,7 @@ class Image extends File } } } - + //获取水印位置键值对 public static function getMarkPosition() { @@ -73,7 +73,7 @@ class Image extends File public static function delImg($src) { if(!empty(trim($src))){ - $realPath = app()->getRootPath() . 'wwwroot/' . ltrim($src, '/'); + $realPath = app()->getRootPath() . 'public/' . ltrim($src, '/'); if (file_exists($realPath)) { $info = pathinfo($realPath); $source = $info['dirname'] . DIRECTORY_SEPARATOR . $info['filename'] . '*.' . $info['extension']; @@ -100,7 +100,7 @@ class Image extends File return ''; } $rootPath = app()->getRootPath(); - $realPath = $rootPath . 'wwwroot/' . ltrim($src, '/'); + $realPath = $rootPath . 'public/' . ltrim($src, '/'); $realPath = str_replace('\\', '/', $realPath); if(!file_exists($realPath)){ return ''; @@ -120,7 +120,7 @@ class Image extends File return $src; } $thumbName = $info['dirname']. DIRECTORY_SEPARATOR .$info['filename'].'_'.$width.'_'.$height.'.'.$info['extension']; - $realThumbName = $rootPath . 'wwwroot/' . ltrim($thumbName, '/'); + $realThumbName = $rootPath . 'public/' . ltrim($thumbName, '/'); $realThumbName = str_replace('\\', '/', $realThumbName); if(!file_exists($realThumbName)){ $image = TImage::open($realPath); diff --git a/config/filesystem.php b/config/filesystem.php index 5d636ab..9fce6e1 100755 --- a/config/filesystem.php +++ b/config/filesystem.php @@ -11,7 +11,7 @@ return [ // 磁盘类型 'type' => 'local', // 磁盘路径 - 'root' => app()->getRootPath() . 'wwwroot/storage', + 'root' => app()->getRootPath() . 'public/storage', // 磁盘路径对应的外部URL路径 'url' => '/storage', // 可见性 @@ -21,7 +21,7 @@ return [ // 磁盘类型 'type' => 'local', // 磁盘路径 - 'root' => app()->getRootPath() . 'wwwroot/storage/videos', + 'root' => app()->getRootPath() . 'public/storage/videos', // 磁盘路径对应的外部URL路径 'url' => '/storage/videos', // 可见性 @@ -31,7 +31,7 @@ return [ // 磁盘类型 'type' => 'local', // 磁盘路径 - 'root' => app()->getRootPath() . 'wwwroot/storage/backup', + 'root' => app()->getRootPath() . 'public/storage/backup', // 磁盘路径对应的外部URL路径 'url' => '/storage/backup', // 可见性