From 75e5e52245476a5b4c3f5d986c28c648bc81ca44 Mon Sep 17 00:00:00 2001 From: toom1996 Date: Tue, 29 Jul 2025 11:46:08 +0800 Subject: [PATCH] update --- app/Helpers/ArticleHelper.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Helpers/ArticleHelper.php b/app/Helpers/ArticleHelper.php index 8a29fd6..7ddad1d 100644 --- a/app/Helpers/ArticleHelper.php +++ b/app/Helpers/ArticleHelper.php @@ -7,6 +7,13 @@ class ArticleHelper { public static function saveImagesFromArticle(string $html, string $savePath = '/www/wwwroot/uploads/', string $srcPrefix = '/uploads/') { + if (!$savePath) { + $savePath = env('UPLOAD_ROOT', ''); + if (!$savePath) { + throw new \Exception('找不到存储图片的路径信息。'); + } + } + // 创建保存图片的目录,如果没有的话 if (!file_exists($savePath)) { mkdir($savePath, 0777, true);