增加缩略图开关

This commit is contained in:
evoxwht 2021-11-18 16:58:48 +08:00
parent 0e91ad7340
commit 47f1bf25a1
5 changed files with 15 additions and 4 deletions

View File

@ -177,6 +177,17 @@ class SystemConfigServices extends BaseServices
],
'show_value' => 1
],
'image_thumbnail_status' => [
'son_type' => [
'thumb_big_width' => '',
'thumb_big_height' => '',
'thumb_mid_width' => '',
'thumb_mid_height' => '',
'thumb_small_width' => '',
'thumb_small_height' => '',
],
'show_value' => 1
],
'image_watermark_status' => [
'son_type' => [
'watermark_type' => [

View File

@ -199,7 +199,7 @@ class Cos extends BaseUpload
$height = 'thumb_' . $v . '_height';
$width = 'thumb_' . $v . '_width';
$key = 'filePath' . ucfirst($v);
if (isset($config[$height]) && isset($config[$width]) && $config[$height] && $config[$width]) {
if (sys_config('image_thumbnail_status', 1) && isset($config[$height]) && isset($config[$width]) && $config[$height] && $config[$width]) {
$this->fileInfo->$key = $filePath . '?imageMogr2/thumbnail/' . $config[$width] . 'x' . $config[$height];
$this->fileInfo->$key = $this->water($this->fileInfo->$key);
$data[$v] = $this->fileInfo->$key;

View File

@ -139,7 +139,7 @@ class Local extends BaseUpload
$this->fileInfo->realName = $fileHandle->getOriginalName();
$this->fileInfo->fileName = $this->fileInfo->uploadInfo->getFilename();
$this->fileInfo->filePath = $this->defaultPath . '/' . str_replace('\\', '/', $fileName);
if ($this->checkImage(public_path() . $this->fileInfo->filePath) && $this->authThumb) {
if ($this->checkImage(public_path() . $this->fileInfo->filePath) && $this->authThumb && pathinfo($fileName,PATHINFO_EXTENSION) != 'ico') {
try {
$this->thumb($this->fileInfo->filePath);
} catch (\Throwable $e) {

View File

@ -199,7 +199,7 @@ class Oss extends BaseUpload
$height = 'thumb_' . $v . '_height';
$width = 'thumb_' . $v . '_width';
$key = 'filePath' . ucfirst($v);
if (isset($config[$height]) && isset($config[$width]) && $config[$height] && $config[$width]) {
if (sys_config('image_thumbnail_status', 1) && isset($config[$height]) && isset($config[$width]) && $config[$height] && $config[$width]) {
$this->fileInfo->$key = $filePath . '?x-oss-process=image/resize,h_' . $config[$height] . ',w_' . $config[$width];
$this->fileInfo->$key = $this->water($this->fileInfo->$key);
$data[$v] = $this->fileInfo->$key;

View File

@ -200,7 +200,7 @@ class Qiniu extends BaseUpload
$height = 'thumb_' . $v . '_height';
$width = 'thumb_' . $v . '_width';
$key = 'filePath' . ucfirst($v);
if (isset($config[$height]) && isset($config[$width]) && $config[$height] && $config[$width]) {
if (sys_config('image_thumbnail_status', 1) && isset($config[$height]) && isset($config[$width]) && $config[$height] && $config[$width]) {
$this->fileInfo->$key = $filePath . '?imageView2/2/w/' . $config[$width] . '/h/' . $config[$height];
$this->fileInfo->$key = $this->water($this->fileInfo->$key);
$data[$v] = $this->fileInfo->$key;