ranjith-dev #1587
@@ -185,7 +185,29 @@ class RequestCharacteristicResource extends Resource
|
||||
}
|
||||
|
||||
// Build filename
|
||||
$fileName = "{$workFlowId}.png";
|
||||
// $fileName = "{$workFlowId}.png";
|
||||
|
||||
// $imageUrl = route('workflow.image', [
|
||||
// 'filename' => $fileName,
|
||||
// ]);
|
||||
|
||||
// $set('validation1_image_url', $imageUrl);
|
||||
|
||||
$files = glob(storage_path("app/private/uploads/LaserDocs/{$workFlowId}.*"));
|
||||
|
||||
if (empty($files)) {
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
Notification::make()
|
||||
->title('Validation File Not Found')
|
||||
->body("No validation image or PDF found for Workflow ID: {$workFlowId}")
|
||||
->warning()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$fileName = basename($files[0]);
|
||||
|
||||
$imageUrl = route('workflow.image', [
|
||||
'filename' => $fileName,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
@endif --}}
|
||||
|
||||
@if ($getState())
|
||||
{{-- @if ($getState())
|
||||
<div class="p-4 text-center">
|
||||
<img src="{{ $getState() }}?v={{ time() }}"
|
||||
onerror="this.onerror=null; this.src='{{ asset('images/not-found.png') }}'"
|
||||
@@ -26,6 +26,52 @@
|
||||
class="rounded shadow mx-auto"
|
||||
style="width: 200px; height: 200px; object-fit: contain;" />
|
||||
</div>
|
||||
@endif --}}
|
||||
|
||||
@if ($getState())
|
||||
|
||||
@php
|
||||
$url = $getState() . '?v=' . time();
|
||||
|
||||
$extension = strtolower(
|
||||
pathinfo(parse_url($getState(), PHP_URL_PATH), PATHINFO_EXTENSION)
|
||||
);
|
||||
@endphp
|
||||
|
||||
<div class="p-4 text-center">
|
||||
|
||||
@if ($extension === 'pdf')
|
||||
|
||||
<iframe
|
||||
src="{{ $url }}"
|
||||
width="100%"
|
||||
height="400px"
|
||||
style="border: 1px solid #ddd; border-radius: 8px;">
|
||||
</iframe>
|
||||
|
||||
@else
|
||||
|
||||
<img
|
||||
src="{{ $url }}"
|
||||
onerror="this.onerror=null; this.src='{{ asset('images/not-found.png') }}'"
|
||||
class="rounded shadow mx-auto"
|
||||
style="width: 200px; height: 200px; object-fit: contain;"
|
||||
/>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
<div class="p-4 text-center">
|
||||
<img
|
||||
src="{{ asset('images/not-found.png') }}"
|
||||
class="rounded shadow mx-auto"
|
||||
style="width: 200px; height: 200px; object-fit: contain;"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user