rabin 5 years ago
parent
commit
3f4b517541
2 changed files with 16 additions and 11 deletions
  1. 2 1
      lib/Store/Core.php
  2. 14 10
      src/View.php

+ 2 - 1
lib/Store/Core.php

@@ -4,6 +4,7 @@ namespace Upload\Lib\Store;
 use Dever;
 use Dever\String\Helper as Helper;
 use Dever\Loader\Config;
+use Dever\Support\Img;
 
 class Core
 {
@@ -392,7 +393,7 @@ class Core
 		$this->id = Dever::db('upload/file')->insert($param);
 	}
 
-	private function img()
+	protected function img()
 	{
 		$this->img = isset($this->img) ? $this->img : new Img();
 		$this->img->setType('im');

+ 14 - 10
src/View.php

@@ -328,19 +328,23 @@ class View
                 $file = str_replace($root, $host, $dest);
             }
 
-            if (!strstr($dest, 'http://')) {
-                $temp = explode('/', $path);
-                $key = $temp[0];
-                $image['file']  = false;
-                $image['key']   = $key;
-                $handle = new Handle($image);
-                $method = 'handle_' . $type;
-                $file = $handle->$method($id, $source, $dest, $path);
-
-                echo $file;die;
+            if (is_file($dest)) {
+                $file = $dest;
+            } else {
+                if (!strstr($dest, 'http://')) {
+                    $temp = explode('/', $path);
+                    $key = $temp[0];
+                    $image['file']  = false;
+                    $image['key']   = $key;
+                    $handle = new Handle($image);
+                    $method = 'handle_' . $type;
+                    $file = $handle->$method($id, $source, $dest, $path);
+                }
             }
         }
 
+        $file = Dever::uploadRes($file);
+
 		return $file;
 	}