sugar1569 7 лет назад
Родитель
Сommit
52c87ba750
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      extend/service/UploadService.php

+ 2 - 1
extend/service/UploadService.php

@@ -155,7 +155,7 @@ class UploadService
      */
     public static function thumb($filePath, $ratio=8, $pre='s_')
     {
-        $filePath = '.'.ltrim($filePath,'.');
+        $filePath = ROOT_PATH.ltrim(ltrim($filePath,'.'),'/');
         $img = self::openImage($filePath);
         $width = $img->width() * $ratio / 10;
         $height = $img->height() * $ratio / 10;
@@ -163,6 +163,7 @@ class UploadService
         $fileName = basename($filePath);
         $savePath = $dir.DS.$pre.$fileName;
         $img->thumb($width,$height)->save($savePath);
+        $savePath = str_replace(ROOT_PATH,'',$savePath);
         return ltrim($savePath,'.');
     }
 }