Просмотр исходного кода

修改入口文件上传图片路径

sugar1569 7 лет назад
Родитель
Сommit
bb29ac3cb7
4 измененных файлов с 6 добавлено и 2 удалено
  1. 1 1
      application/admin/view/widget/images.php
  2. 1 1
      extend/service/UploadService.php
  3. 2 0
      index.php
  4. 2 0
      public/index.php

+ 1 - 1
application/admin/view/widget/images.php

@@ -77,7 +77,7 @@
             {volist name="list" id="vo"}
             <div class="image-item">
                 <div class="image-delete" data-url="{:Url('delete',array('att_id'=>$vo.att_id))}"></div>
-                <img class="pic" src="{$vo.att_dir|ltrim='.'}" id="{$vo.att_id}"/>
+                <img class="pic" src="{UPLOAD_PATH}{$vo.att_dir|ltrim='.'}" id="{$vo.att_id}"/>
             </div>
             {/volist}
         </div>

+ 1 - 1
extend/service/UploadService.php

@@ -163,7 +163,7 @@ class UploadService
         $fileName = basename($filePath);
         $savePath = $dir.DS.$pre.$fileName;
         $img->thumb($width,$height)->save($savePath);
-        $savePath = str_replace(ROOT_PATH.'public','',$savePath);
+        $savePath = str_replace(ROOT_PATH.'public/uploads','',$savePath);
         return ltrim($savePath,'.');
     }
 }

+ 2 - 0
index.php

@@ -25,5 +25,7 @@ if(file_exists("./public/install/") && !file_exists("./public/install/install.lo
 define('APP_PATH', __DIR__ . '/application/');
 //静态文件目录
 define('PUBILC_PATH', '/public/');
+//上传文件目录
+define('UPLOAD_PATH', '/public/uploads');
 // 加载框架引导文件
 require __DIR__ . '/thinkphp/start.php';

+ 2 - 0
public/index.php

@@ -25,5 +25,7 @@ if(file_exists("./install/") && !file_exists("./install/install.lock")){
 define('APP_PATH', __DIR__ . '/../application/');
 //静态文件目录
 define('PUBILC_PATH', '/');
+//上传文件目录
+define('UPLOAD_PATH', '/uploads');
 // 加载框架引导文件
 require __DIR__ . '/../thinkphp/start.php';