|
@@ -163,7 +163,7 @@ class Core
|
|
|
*/
|
|
|
private function check_size()
|
|
|
{
|
|
|
- if (!$this->limit) {
|
|
|
+ if (!$this->limit && !$this->base64 && ($this->ext == '.jpg' || $this->ext == '.gif' || $this->ext == '.png')) {
|
|
|
$this->limit = getimagesize($this->data['file']['tmp_name']);
|
|
|
}
|
|
|
|
|
@@ -176,10 +176,10 @@ class Core
|
|
|
if (($size < $this->data['file']['size']) && $size > 0) {
|
|
|
$this->output['status'] = -1;
|
|
|
$this->output['message'] = '文件不能超过'.(($size/1024)/1024).'MB';
|
|
|
- } elseif ($this->config['width'] > 0 && $this->config['width'] < $this->limit[0]) {
|
|
|
+ } elseif ($this->limit && $this->config['width'] > 0 && $this->config['width'] < $this->limit[0]) {
|
|
|
$this->output['status'] = -1;
|
|
|
$this->output['message'] = '图片宽度不能超过' . $this->config['width'] . 'px';
|
|
|
- } elseif ($this->config['height'] > 0 && $this->config['height'] < $this->limit[1]) {
|
|
|
+ } elseif ($this->limit && $this->config['height'] > 0 && $this->config['height'] < $this->limit[1]) {
|
|
|
$this->output['status'] = -1;
|
|
|
$this->output['message'] = '图片高度不能超过' . $this->config['height'] . 'px';
|
|
|
}
|
|
@@ -198,13 +198,18 @@ class Core
|
|
|
$this->output['status'] = 1;
|
|
|
|
|
|
if (is_string($this->data['file'])) {
|
|
|
- if (strstr($this->data['file'], 'base64,') && isset($this->data['pic'])) {
|
|
|
+ if (strstr($this->data['file'], 'base64,')) {
|
|
|
$temp = explode('base64,', $this->data['file']);
|
|
|
$type = str_replace(array('data:', ';'), '', $temp[0]);
|
|
|
$file = str_replace(' ', '+', $temp[1]);
|
|
|
$file = str_replace('=', '', $temp[1]);
|
|
|
$file = base64_decode($file);
|
|
|
- $name = $this->data['local'] = Dever::local($this->data['pic']);
|
|
|
+ if (isset($this->data['pic'])) {
|
|
|
+ $name = $this->data['local'] = Dever::local($this->data['pic']);
|
|
|
+ } else {
|
|
|
+ $name = Dever::rand(10);
|
|
|
+ }
|
|
|
+
|
|
|
$size = strlen($file);
|
|
|
$size = number_format(($size - ($size/8)*2)/1024, 2);
|
|
|
$this->base64 = true;
|
|
@@ -629,6 +634,7 @@ class Core
|
|
|
'audio/x-mpegurl' => 'm3u',
|
|
|
'audio/x-pn-realaudio' => 'ram',
|
|
|
'audio/x-wav' => 'wav',
|
|
|
+ 'image/png' => 'png',
|
|
|
'image/bmp' => 'bmp',
|
|
|
'image/cis-cod' => 'cod',
|
|
|
'image/gif' => 'gif',
|