file-display.blade.php 697 B

1234567891011121314151617181920
  1. {{-- resources/views/components/allegati/file-display.blade.php --}}
  2. @props(['files' => []])
  3. @foreach($files as $file)
  4. @php
  5. $filePath = storage_path('app/public/' . $file);
  6. $extension = pathinfo($filePath, PATHINFO_EXTENSION);
  7. $allowedExtensions = ['jpg', 'jpeg', 'png', 'gif'];
  8. @endphp
  9. @if(file_exists($filePath) && in_array(strtolower($extension), $allowedExtensions))
  10. <div class="image-container" style="margin-bottom: 5px;">
  11. <img
  12. src="{{ $filePath }}"
  13. alt="{{ basename($file) }}"
  14. style="max-width: 100%; height: auto; display: block;"
  15. >
  16. </div>
  17. @endif
  18. @endforeach