dever 6 роки тому
батько
коміт
102a304a18
4 змінених файлів з 34 додано та 15 видалено
  1. 1 1
      database/upload.php
  2. 23 0
      src/Store/Handle.php
  3. 2 11
      src/Store/Qiniu.php
  4. 8 3
      src/View.php

+ 1 - 1
database/upload.php

@@ -239,7 +239,7 @@ return array
 		'button' => array
 		(
 			'图片水印配置' => array('location', 'manage/project/database/list&project=upload&table=pic_water'),
-			'图片缩略配置' => array('location', 'manage/project/database/list&project=upload&table=pic_thump'),
+			'图片缩略配置' => array('location', 'manage/project/database/list&project=upload&table=pic_thumb'),
 			'图片裁剪配置' => array('location', 'manage/project/database/list&project=upload&table=pic_crop'),
 		),
 	),

+ 23 - 0
src/Store/Handle.php

@@ -75,4 +75,27 @@ class Handle
             return $yun;
         }
     }
+
+    public function handle_t($id, $source, $dest, $path)
+    {
+        $yun = $local = array();
+
+        if ($this->save_type <= 3) {
+            $local = $this->local->handle_t($id, $source, $dest);
+        }
+
+        if ($local && $local['status'] == -1) {
+            return $local;
+        }
+
+        if ($this->save_type >= 2) {
+            $yun = $this->yun->handle_t($id, $source, $dest, $path);
+        }
+
+        if ($this->save_type <= 2) {
+            return $local;
+        } elseif ($this->save_type > 2) {
+            return $yun;
+        }
+    }
 }

+ 2 - 11
src/Store/Qiniu.php

@@ -195,7 +195,7 @@ class Qiniu extends Core implements Config
      * 
      * @return mixed
      */
-    public function handle_t($id, $source = false, $dest = false)
+    public function handle_t($id, $source = false, $dest = false, $path = '')
     {
         $config = Dever::load('upload/pic_thumb-one', $id);
         if ($config) {
@@ -204,16 +204,7 @@ class Qiniu extends Core implements Config
                 $source = $this->output['file'];
             }
 
-            if (!$dest) {
-                if (strpos($this->name, '_t') !== false) {
-                    $temp = explode('_t', $this->name);
-                    $this->name = $temp[0];
-                }
-                $this->name .= '_t' . $id;
-                $dest = $this->file();
-            }
-
-            $dest = $source . '?imageView2/1/w/'.$config['width'].'/h/'.$config['height'].'/q/75';
+            $dest = $source . '?imageView2/2/w/'.$config['width'].'/h/'.$config['height'];
 
             if (isset($config['compress']) && $config['compress'] > 0) {
                 $dest = $dest . '/q/' . $config['compress'];

+ 8 - 3
src/View.php

@@ -7,7 +7,7 @@
 namespace Upload\Src;
 
 use Dever;
-use Upload\Src\Store\Local as Handle;
+use Upload\Src\Store\Handle;
 use Upload\Src\Lib\Img;
 
 class View
@@ -185,6 +185,7 @@ class View
             $host = Dever::config('host')->uploadRes;
             $root = Dever::data() . 'upload/';
             $dest = str_replace(array('{uploadRes}', $host), $root, $file);
+            $path = str_replace(array('{uploadRes}', $host), '', $file);
             if (strstr($source, $host)) {
                 
                 $source = $root . str_replace($host, '', $source);
@@ -201,9 +202,13 @@ class View
             }
 
             if (!strstr($dest, 'http://') && !is_file($dest)) {
-                $handle = new Handle();
+                $temp = explode('/', $path);
+                $key = $temp[0];
+                $image['file']  = false;
+                $image['key']   = $key;
+                $handle = new Handle($image);
                 $method = 'handle_' . $type;
-                $handle->$method($id, $source, $dest);
+                $file = $handle->$method($id, $source, $dest, $path);
             }
         }