Aknaproff/resources/views/form_data/file_view.blade.php

26 lines
950 B
PHP
Raw Normal View History

2023-09-21 12:45:08 +00:00
@php
$datas = implode(',', $form_upload);
$files = explode(',', $datas);
@endphp
@foreach($files as $file)
@php
$url = Storage::url(config('constants.doc_path').'/'.$file);
$path = public_path('uploads/'.config('constants.doc_path').'/'.$file);
@endphp
@if(file_exists($path))
@php
$media = explode('_', $file, 2);
$file_name = !empty($media[1]) ? $media[1]: $media[0];
@endphp
@if(in_array(mime_content_type($path), ['image/jpeg', 'image/png', 'image/webp']))
<a target="_blank" href="{{$url}}" download="{{$file_name}}">
<img src="{{$url}}" alt="{{$file_name}}" style="width:100px;height: 90px;object-fit: contain;max-width: 100%;">
</a>
@else
<a target="_blank" href="{{$url}}" download="{{$file_name}}">
{{$file_name}}
</a>
@endif
<br>
@endif
@endforeach