dever 6 rokov pred
rodič
commit
4361e054e5
2 zmenil súbory, kde vykonal 13 pridanie a 9 odobranie
  1. 11 7
      src/Save.php
  2. 2 2
      src/Store/Core.php

+ 11 - 7
src/Save.php

@@ -25,15 +25,19 @@ class Save
 		}
 	}
 
-	public function copy($file, $key = 1)
+	public function copy($file = false, $key = 1)
 	{
-		$image['file'] 	= $file;
-		$image['key'] 	= $key;
-		$handle = new Handle($image);
+		if ($this->output) {
+			Dever::outDiy($this->output);
+		} else {
+			$image['file'] 	= $file;
+			$image['key'] 	= $key;
+			$handle = new Handle($image);
 
-		$this->output = $handle->copy();
-		unset($this->output['file']);
-		return $this->output;
+			$this->output = $handle->copy();
+			unset($this->output['file']);
+			return $this->output;
+		}
 	}
 
 	public function copys($file, $key = 1)

+ 2 - 2
src/Store/Core.php

@@ -190,7 +190,7 @@ class Core
 			header('Content-type: text/json; charset=utf-8');
 
 			$path = Dever::path($this->base, 'tmp/');
-			$name = $this->data['file'];
+			$name = urldecode($this->data['file']);
 			$this->data['file'] = array();
 			$this->data['file']['name'] = 'Tmp' . sha1($name);
 			//$this->data['file']['name'] = 'Tmp' . Helper::rand(8) . md5(microtime() . rand(0,1000)) . '.jpg';
@@ -329,7 +329,7 @@ class Core
 
 	public function delete()
 	{
-		unlink($this->data['file']['tmp_name']);
+		@unlink($this->data['file']['tmp_name']);
 	}
 
 	/**