|
@@ -23,7 +23,7 @@ class Core
|
|
|
|
|
|
protected $path;
|
|
|
|
|
|
- protected $ext;
|
|
|
+ protected $ext = '';
|
|
|
|
|
|
protected $file;
|
|
|
|
|
@@ -130,13 +130,14 @@ class Core
|
|
|
*/
|
|
|
private function check_type()
|
|
|
{
|
|
|
- $ext = $this->getExt($this->data['file']['tmp_name']);
|
|
|
- if (strpos($this->config['type'], $ext) === false) {
|
|
|
- $this->output['status'] = -1;
|
|
|
- $this->output['message'] = '文件格式不符合要求';
|
|
|
+ if (!$this->ext) {
|
|
|
+ $ext = $this->getExt($this->data['file']['tmp_name']);
|
|
|
+ if (strpos($this->config['type'], $ext) === false) {
|
|
|
+ $this->output['status'] = -1;
|
|
|
+ $this->output['message'] = '文件格式不符合要求';
|
|
|
+ }
|
|
|
+ $this->ext = '.' . $ext;
|
|
|
}
|
|
|
-
|
|
|
- $this->ext = '.' . $ext;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -197,6 +198,9 @@ class Core
|
|
|
|
|
|
if (!is_file($this->data['file']['tmp_name'])) {
|
|
|
$file = Dever::curl($name);
|
|
|
+ if (stristr($file, 'webp')) {
|
|
|
+ $this->ext = '.jpg';
|
|
|
+ }
|
|
|
file_put_contents($this->data['file']['tmp_name'], $file);
|
|
|
}
|
|
|
$this->data['file']['size'] = filesize($this->data['file']['tmp_name']);
|
|
@@ -470,7 +474,7 @@ class Core
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * getExt 已废弃
|
|
|
+ * getExt
|
|
|
*
|
|
|
* @return mixed
|
|
|
*/
|