xcw 2024-12-03 15:30:34 +08:00
commit a4d7590f0d
3 changed files with 17 additions and 17 deletions

View File

@ -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;
}
}
@ -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());

View File

@ -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'], '/');
@ -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);

View File

@ -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',
// 可见性