分离首页和详情页面

This commit is contained in:
2025-06-17 14:50:28 +08:00
parent c1babbe04b
commit 932c1f4e46
2 changed files with 4 additions and 3 deletions

View File

@@ -12,7 +12,8 @@ class ImageController extends Controller
{
// 获取post的image参数
$image = request()->file('image');
$pid = request()->file('pid');
return new ImageService()->processImage($image);
return new ImageService()->processImage($image, $pid);
}
}

View File

@@ -15,7 +15,7 @@ class ImageService
* @param UploadedFile $imageFile
* @return array 包含三个路径的数组
*/
public function processImage($imageFile)
public function processImage($imageFile, $pid = 1)
{
// 1. 保存原始图片
$originalPath = $this->storeOriginalImage($imageFile);
@@ -27,7 +27,7 @@ class ImageService
$watermarkedPath = $this->addWatermark($compressedPath);
ImagesModel::create([
'photo_album_id' => 1,
'photo_album_id' => $pid,
'title' => date('Y-m-d H:i:s'),
'original' => $originalPath,
'compressed' => $compressedPath,