分离首页和详情页面
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user