更新:图片处理文件更新访问根目录为wwwroot

virtual
zwesy 2020-12-10 17:36:21 +08:00
parent 66047618a4
commit c49f41ffc5
1 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ class Image extends File
public static function resize($src) public static function resize($src)
{ {
$max = 1920; $max = 1920;
$realPath = app()->getRootPath() . 'public/' . ltrim($src,'/'); $realPath = app()->getRootPath() . 'wwwroot/' . ltrim($src,'/');
if(is_file($realPath)){ if(is_file($realPath)){
$img = TImage::open($realPath); $img = TImage::open($realPath);
list($img_w,$img_h) = $img->size(); list($img_w,$img_h) = $img->size();
@ -34,7 +34,7 @@ class Image extends File
$rootPath = app()->getRootPath(); $rootPath = app()->getRootPath();
if(!empty($src)){ if(!empty($src)){
$system = System::getSystem(); $system = System::getSystem();
$realPath = $rootPath . 'public/' . ltrim($src, '/'); $realPath = $rootPath . 'wwwroot/' . ltrim($src, '/');
if(is_file($realPath)){ if(is_file($realPath)){
if($system['is_mark']){ if($system['is_mark']){
$mark = $rootPath . ltrim($system['mark_img'], '/'); $mark = $rootPath . ltrim($system['mark_img'], '/');
@ -73,7 +73,7 @@ class Image extends File
public static function delImg($src) public static function delImg($src)
{ {
if(!empty(trim($src))){ if(!empty(trim($src))){
$realPath = app()->getRootPath() . 'public/' . ltrim($src, '/'); $realPath = app()->getRootPath() . 'wwwroot/' . ltrim($src, '/');
if (file_exists($realPath)) { if (file_exists($realPath)) {
$info = pathinfo($realPath); $info = pathinfo($realPath);
$source = $info['dirname'] . DIRECTORY_SEPARATOR . $info['filename'] . '*.' . $info['extension']; $source = $info['dirname'] . DIRECTORY_SEPARATOR . $info['filename'] . '*.' . $info['extension'];
@ -100,7 +100,7 @@ class Image extends File
return ''; return '';
} }
$rootPath = app()->getRootPath(); $rootPath = app()->getRootPath();
$realPath = $rootPath . 'public/' . ltrim($src, '/'); $realPath = $rootPath . 'wwwroot/' . ltrim($src, '/');
$realPath = str_replace('\\', '/', $realPath); $realPath = str_replace('\\', '/', $realPath);
if(!file_exists($realPath)){ if(!file_exists($realPath)){
return ''; return '';
@ -120,7 +120,7 @@ class Image extends File
return $src; return $src;
} }
$thumbName = $info['dirname']. DIRECTORY_SEPARATOR .$info['filename'].'_'.$width.'_'.$height.'.'.$info['extension']; $thumbName = $info['dirname']. DIRECTORY_SEPARATOR .$info['filename'].'_'.$width.'_'.$height.'.'.$info['extension'];
$realThumbName = $rootPath . 'public/' . ltrim($thumbName, '/'); $realThumbName = $rootPath . 'wwwroot/' . ltrim($thumbName, '/');
$realThumbName = str_replace('\\', '/', $realThumbName); $realThumbName = str_replace('\\', '/', $realThumbName);
if(!file_exists($realThumbName)){ if(!file_exists($realThumbName)){
$image = TImage::open($realPath); $image = TImage::open($realPath);