作者 lyh

hx

@@ -238,8 +238,7 @@ class NewsLogic extends BaseLogic @@ -238,8 +238,7 @@ class NewsLogic extends BaseLogic
238 foreach ($imageSources as $src) { 238 foreach ($imageSources as $src) {
239 if (preg_match('/^data:image\/(png|jpg|jpeg|gif);base64,/', $src, $match)) { 239 if (preg_match('/^data:image\/(png|jpg|jpeg|gif);base64,/', $src, $match)) {
240 $imageType = $match[1]; // Image type (png, jpg, etc.) 240 $imageType = $match[1]; // Image type (png, jpg, etc.)
241 - $base64Data = preg_replace('/^data:image\/(png|jpg|jpeg|gif);base64,/', '', $src);  
242 - $imageUrl = $this->manager_uploads($base64Data,$imageType); 241 + $imageUrl = $this->manager_uploads($src,$imageType);
243 $updatedSources[$imageUrl] = $src; 242 $updatedSources[$imageUrl] = $src;
244 } 243 }
245 } 244 }
@@ -257,9 +256,6 @@ class NewsLogic extends BaseLogic @@ -257,9 +256,6 @@ class NewsLogic extends BaseLogic
257 $path = $this->uploads['path_b'].'/'.($this->user['project_id'] ?? 1618).'/image_news/'.date('Y-m'); 256 $path = $this->uploads['path_b'].'/'.($this->user['project_id'] ?? 1618).'/image_news/'.date('Y-m');
258 $cosService = new CosService(); 257 $cosService = new CosService();
259 $fileName = md5(uniqid() . '_' . time() . '.' . ($this->user['project_id'] ?? 1618).rand(1,10000)) . '.' .$type; 258 $fileName = md5(uniqid() . '_' . time() . '.' . ($this->user['project_id'] ?? 1618).rand(1,10000)) . '.' .$type;
260 - if($this->user['project_id'] == 1618){  
261 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($files, true) . PHP_EOL, FILE_APPEND);  
262 - }  
263 return getImageUrl($cosService->uploadFile($files,$path,$fileName)); 259 return getImageUrl($cosService->uploadFile($files,$path,$fileName));
264 } 260 }
265 /** 261 /**