|
@@ -1722,7 +1722,17 @@ if(!function_exists('save_base64_image')){
|
|
|
{
|
|
{
|
|
|
$content = str_replace('data:image/png;base64,','', urldecode(trim($base64)));
|
|
$content = str_replace('data:image/png;base64,','', urldecode(trim($base64)));
|
|
|
$save_path = create_image_path($save_dir, $ext);
|
|
$save_path = create_image_path($save_dir, $ext);
|
|
|
- return file_put_contents(ATTACHMENT_PATH . $save_path, base64_decode($content)) ? $save_path : false;
|
|
|
|
|
|
|
+ $driver = \App\Services\ConfigService::make()->getConfigByCode('file_upload_driver','local');
|
|
|
|
|
+ if($driver == 'qiniu'){
|
|
|
|
|
+ if($path = \App\Services\QiniuService::make()->uploadBase64($save_path, base64_decode($content))){
|
|
|
|
|
+ return $path;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return file_put_contents(ATTACHMENT_PATH . $save_path, base64_decode($content)) ? $save_path : false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1917,9 +1927,6 @@ if (!function_exists('upload_image')) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// 返回结果
|
|
// 返回结果
|
|
|
$result = [
|
|
$result = [
|
|
|
'img_original_name' => $original_name,
|
|
'img_original_name' => $original_name,
|