|
@@ -226,13 +226,17 @@ class Core
|
|
|
|
|
|
$size = round(($size - ($size/8)*2)/1024, 2);
|
|
|
$this->base64 = true;
|
|
|
+ } elseif (strstr($this->data['file'], 'content,')) {
|
|
|
+ $file = str_replace('content,', '', $this->data['file']);
|
|
|
+ $this->data['cropper'] = 1;
|
|
|
} else {
|
|
|
$name = urldecode($this->data['file']);
|
|
|
}
|
|
|
|
|
|
$this->data['file'] = array();
|
|
|
- if (((isset($this->data['cropper']) && !$this->yun) || !isset($this->data['cropper'])) && strstr($name, 'http') && !$this->yun) {
|
|
|
+ if (((isset($this->data['cropper']) && !$this->yun) || (!isset($this->data['cropper'])) && strstr($name, 'http') && !$this->yun)) {
|
|
|
$this->base64 = false;
|
|
|
+
|
|
|
$this->root();
|
|
|
|
|
|
$path = Dever::path($this->base, 'tmp/');
|
|
@@ -248,7 +252,11 @@ class Core
|
|
|
$this->ext = '.' . pathinfo($filename, PATHINFO_EXTENSION);
|
|
|
}
|
|
|
|
|
|
- $this->data['file']['name'] = 'Tmp' . sha1($filename);
|
|
|
+ if (isset($this->data['name']) && $this->data['name']) {
|
|
|
+ $this->data['file']['name'] = 'Tmp' . sha1($this->data['name']);
|
|
|
+ } else {
|
|
|
+ $this->data['file']['name'] = 'Tmp' . sha1($filename);
|
|
|
+ }
|
|
|
$this->data['file']['tmp_name'] = $path . $this->data['file']['name'];
|
|
|
|
|
|
if (!is_file($this->data['file']['tmp_name'])) {
|
|
@@ -261,7 +269,7 @@ class Core
|
|
|
$file = Dever::curl($name);
|
|
|
}
|
|
|
|
|
|
- if (stristr($file, 'webp')) {
|
|
|
+ if ($this->ext != '.mp4' && stristr($file, 'webp')) {
|
|
|
|
|
|
$this->ext = '.jpg';
|
|
|
}
|
|
@@ -270,6 +278,7 @@ class Core
|
|
|
$this->output['message'] = '错误的文件来源';
|
|
|
return $this->output;
|
|
|
}
|
|
|
+
|
|
|
$state = file_put_contents($this->data['file']['tmp_name'], $file);
|
|
|
if (!$state) {
|
|
|
$this->delete();
|
|
@@ -470,7 +479,11 @@ class Core
|
|
|
|
|
|
if (!$this->path) {
|
|
|
$date = explode('-', date("Y-m-d"));
|
|
|
- $this->path = $this->config['id'] . '/' . $date[0] . '/' . $date[1] . '/' . $date[2] . '/';
|
|
|
+ if (isset($this->data['id']) && $this->data['id']) {
|
|
|
+ $this->path = $this->config['id'] . '/' . Dever::pathId($this->data['id']);
|
|
|
+ } else {
|
|
|
+ $this->path = $this->config['id'] . '/' . $date[0] . '/' . $date[1] . '/' . $date[2] . '/';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return $this;
|