dever 6 éve
szülő
commit
1505752b4f
2 módosított fájl, 17 hozzáadás és 7 törlés
  1. 14 3
      lib/Store/Core.php
  2. 3 4
      lib/Store/Local.php

+ 14 - 3
lib/Store/Core.php

@@ -34,6 +34,8 @@ class Core
 	protected $base64 = false;
 
 	protected $yun = false;
+
+	protected $id = false;
 	
 	/**
 	 * __construct
@@ -190,7 +192,7 @@ class Core
 		        $file = base64_decode($file);
 		        $name = $this->data['local'] = Dever::local($this->data['pic']);
 		        $size = strlen($file);
-		        $size = ($size - ($size/8)*2)/1024;
+		        $size = number_format(($size - ($size/8)*2)/1024, 2);
 		        $this->base64 = true;
 			} else {
 				$name = urldecode($this->data['file']);
@@ -298,6 +300,15 @@ class Core
 
 		$this->output['status'] = 1;
 		$this->output['name'] = $this->data['file']['name'];
+		$this->output['fid'] = $this->id;
+		if ($this->limit) {
+			$this->output['width'] = $this->limit[0];
+			$this->output['height'] = $this->limit[1];
+		}
+
+		if ($this->size) {
+			$this->output['size'] = $this->size;
+		}
 
 		return $this->output;
 	}
@@ -323,7 +334,7 @@ class Core
 			$param['set_size'] = $this->size;
 		}
 		
-		$param['where_id'] = $id;
+		$this->id = $param['where_id'] = $id;
 
 		Dever::load('upload/file-update', $param);
 	}
@@ -354,7 +365,7 @@ class Core
 
 		//file_put_contents(DEVER_PATH . 'data/test', var_export($param,true));
 
-		Dever::load('upload/file-insert', $param);
+		$this->id = Dever::load('upload/file-insert', $param);
 	}
 
 	private function img()

+ 3 - 4
lib/Store/Local.php

@@ -66,14 +66,13 @@ class Local extends Core implements Config
 	public function file()
 	{
 		if ($this->base64 && isset($this->data['local'])) {
+			$this->data['local'] = str_replace(Dever::data() . 'upload/', '', $this->data['local']);
 			$this->file = $this->data['local'] . $this->name . $this->ext;
-			$this->output['file'] = $this->file;
-			$this->output['url'] = Dever::pic($this->output['file']);
 		} else {
 			$this->file = $this->path . $this->name . $this->ext;
-			$this->output['file'] = is_file($this->base . $this->file) ? $this->base . $this->file : Dever::path($this->base, $this->file);
-			$this->output['url'] = Dever::config('host')->uploadRes . $this->file;
 		}
+		$this->output['file'] = is_file($this->base . $this->file) ? $this->base . $this->file : Dever::path($this->base, $this->file);
+		$this->output['url'] = Dever::config('host')->uploadRes . $this->file;
 
 		return $this->output['file'];
 	}