This commit is contained in:
Shaun Collins
2026-03-04 16:34:33 +00:00
committed by shaun collins
commit 646041230b
15 changed files with 459 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ImagesController extends Controller
{
public function show(Request $request, string $file)
{
try {
return response()->file($this->imagePath($file));
} catch (\Exception $e) {
abort(404);
}
}
public function subDirectory(Request $request, string $directory, string $file)
{
try {
return response()->file($this->imagePath("{$directory}/{$file}"));
} catch (\Exception $e) {
abort(404);
}
}
private function imagePath(string $file): string
{
return resource_path('images/'.$file);
}
}