作者 lyh

gx

... ... @@ -366,6 +366,7 @@ class ImageController extends Controller
* @time :2024/8/24 11:03
*/
public function getProjectConfig($project_id = 0){
$str = '';
$imageSettingModel = new ImageSetting();
$settingInfo = $imageSettingModel->read(['project_id'=>$project_id]);
if($settingInfo !== false){
... ... @@ -377,7 +378,8 @@ class ImageController extends Controller
}
$image_data[$k] = $v;
}
return $image_data;
$str = 'watermark/1/'.implode('/',$image_data);
return $str;
}
if($settingInfo['status'] == 2 && !empty($settingInfo['str_data'])){
$str_data = json_decode($settingInfo['str_data'],true);
... ... @@ -398,9 +400,10 @@ class ImageController extends Controller
$str_data[$k] = $v;
}
}
return $str_data;
$str = 'watermark/2/'.implode('/',$str_data);
return $str;
}
return null;
return $str;
}
/**
... ...
... ... @@ -23,7 +23,7 @@ class CosService
* @method :post
* @time :2023/7/19 15:28
*/
public function uploadFile(&$files,$path,$filename, $binary = false,$watermarkOptions = null)
public function uploadFile(&$files,$path,$filename, $binary = false,$watermarkOptions = '')
{
$cos = config('filesystems.disks.cos');
$cosClient = new Client([
... ... @@ -41,14 +41,13 @@ class CosService
'Body' => $Body,
];
//水印
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($watermarkOptions, true) . PHP_EOL, FILE_APPEND);
if ($watermarkOptions) {
$options['PicOperations'] = json_encode([
'is_pic_info' => 1,
'rules' => [
[
'fileid' => $key, // 使用相同的文件名保存
'rule' => 'watermark/2/'.implode('/',$watermarkOptions),
'rule' => $watermarkOptions,
]
]
], true);
... ...