This commit is contained in:
2024-06-07 16:26:15 +02:00
parent d01c7d3868
commit 154e79aacd
11 changed files with 153 additions and 29 deletions

View File

@@ -37,9 +37,33 @@ class ImageController extends Controller
/**
* Display the specified resource.
*/
public function show(Image $image) : BinaryFileResponse
public function show(Image $image, string $size = 'original') : BinaryFileResponse
{
return response()->file(Storage::disk('images')->path($image->album->id . '/thumbnail/' . $image->id . '.avif'));
return response()->file(Storage::disk('images')->path($image->album->id . '/' . $size . '/' . $image->id . '.avif'));
}
/**
* Display the thumbnail of the specified resource.
*/
public function thumbnail(Image $image) : BinaryFileResponse
{
return $this->show($image, 'thumbnail');
}
/**
* Display the lightbox of the specified resource.
*/
public function lightbox(Image $image) : BinaryFileResponse
{
return $this->show($image, 'lightbox');
}
/**
* Display the lightbox of the specified resource.
*/
public function download(Image $image)
{
return Storage::disk('images')->download($image->album_id . '/original/' . $image->id . '.avif', name: $image->album->name . '_' . $image->id . '.avif');
}
/**