ranjith-dev #1587

Merged
jothi merged 3 commits from ranjith-dev into master 2026-12-01 10:05:04 +00:00
Showing only changes of commit 7ca4eec965 - Show all commits

View File

@@ -141,14 +141,43 @@ Route::get('/part-validation-image/{filename}', function ($filename) {
return response()->file($path);
})->name('part.validation.image');
Route::get('/workflow-image/{filename}', function ($filename) {
$path = storage_path("app/private/uploads/LaserDocs/{$filename}");
// Route::get('/workflow-image/{filename}', function ($filename) {
// $path = storage_path("app/private/uploads/LaserDocs/{$filename}");
if (! file_exists($path)) {
abort(404, 'Image not found');
// if (! file_exists($path)) {
// abort(404, 'Image not found');
// }
// return response()->file($path);
// })->name('workflow.image');
Route::get('/workflow-image/{filename}', function ($filename) {
$directory = storage_path('app/private/uploads/LaserDocs');
$files = glob($directory . '/' . basename($filename));
if (empty($files)) {
abort(404, 'File not found');
}
return response()->file($path);
$path = $files[0];
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
if ($extension === 'pdf') {
return response()->file($path, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="' . basename($path) . '"',
]);
}
if (in_array($extension, ['png', 'jpg', 'jpeg'])) {
return response()->file($path);
}
abort(403, 'Unsupported file format');
})->name('workflow.image');
// web.php