分离首页和详情页面

This commit is contained in:
2025-06-17 15:06:22 +08:00
parent 678a1c6bf9
commit 807d2dce01

View File

@@ -18,7 +18,7 @@ class ImageService
public function processImage($imageFile, $pid = 1)
{
// 1. 保存原始图片
$originalPath = $this->storeOriginalImage($imageFile);
$originalPath = $this->storeOriginalImage(file_get_contents($imageFile));
// 2. 无损压缩图片
$compressedPath = $this->compressToWebp($originalPath);
@@ -46,9 +46,8 @@ class ImageService
*/
protected function storeOriginalImage($imageFile)
{
$path = 'images/original/' . Str::random(40) . '.' . $imageFile->getClientOriginalExtension();
dd([$imageFile, $path]);
Storage::put($path, file_get_contents($imageFile));
$path = 'images/original/cc_'. date('Ymdhis') . Str::random(40) . '.' . $imageFile->getClientOriginalExtension();
Storage::put($path, $imageFile);
return $path;
}