@props(['fileType', 'size' => '1.2rem', 'showLabel' => false, 'showImage' => false, 'imageUrl' => null, 'rotatingToolbar' => false, 'documentId' => null, 'allImages' => [],'currentIndex' => 0]) @php $fileIcon = get_file_type_icon($fileType); // Normalize file type to handle both MIME types and extensions $normalizedType = strtolower($fileType); // Check if it's an image (support both MIME types and extensions) $imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'tiff', 'tif', 'heic', 'heif']; $imageMimeTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/bmp', 'image/webp', 'image/svg+xml', 'image/tiff', 'image/tif', 'image/heic', 'image/heif', 'image/heic-sequence']; // Also check if the normalized type contains 'heic' or 'heif' to catch any variations $isHeic = str_contains($normalizedType, 'heic') || str_contains($normalizedType, 'heif'); $isImage = in_array($normalizedType, $imageExtensions) || in_array($normalizedType, $imageMimeTypes) || $isHeic || str_contains($normalizedType, 'image/'); // Check if it's a PDF (support both MIME type and extension) $isPdf = $normalizedType === 'application/pdf' || $normalizedType === 'pdf'; @endphp
@if ($isImage && $showImage && $imageUrl != null) @php $modalId = 'imagePreviewModal-' . md5($imageUrl); $uniqueId = 'img-' . uniqid(); $isHeicFile = $isHeic || str_contains(strtolower($imageUrl), '.heic') || str_contains(strtolower($imageUrl), '.heif'); @endphp file preview @if($rotatingToolbar) @once @push('scripts') @endpush @endonce @endif @elseif ($isPdf && $showImage && $imageUrl != null) @php $modalId = 'pdfPreviewModal-' . md5($imageUrl); @endphp
@else
@endif @if($showLabel) {{ strtoupper($fileType) }} @endif @once @push('scripts') @endpush @endonce