Added pdf shown logic in request characteristics route
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 18s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Laravel Pint / pint (pull_request) Successful in 5m3s
Laravel Larastan / larastan (pull_request) Failing after 11m53s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 18s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Laravel Pint / pint (pull_request) Successful in 5m3s
Laravel Larastan / larastan (pull_request) Failing after 11m53s
This commit is contained in:
@@ -141,14 +141,43 @@ Route::get('/part-validation-image/{filename}', function ($filename) {
|
|||||||
return response()->file($path);
|
return response()->file($path);
|
||||||
})->name('part.validation.image');
|
})->name('part.validation.image');
|
||||||
|
|
||||||
Route::get('/workflow-image/{filename}', function ($filename) {
|
// Route::get('/workflow-image/{filename}', function ($filename) {
|
||||||
$path = storage_path("app/private/uploads/LaserDocs/{$filename}");
|
// $path = storage_path("app/private/uploads/LaserDocs/{$filename}");
|
||||||
|
|
||||||
if (! file_exists($path)) {
|
// if (! file_exists($path)) {
|
||||||
abort(404, 'Image not found');
|
// 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');
|
})->name('workflow.image');
|
||||||
|
|
||||||
// web.php
|
// web.php
|
||||||
|
|||||||
Reference in New Issue
Block a user