@if ($videos->count() > 0) @foreach ($videos as $video) @php $date = \Carbon\Carbon::parse($video->capture_datetime); $timeAgoText = $date->format('F j, Y'); /* $thumbnailPath = str_replace('.mp4', '.jpg', $video->url); if (!empty($thumbnailPath)) { $thumbnailUrl = Storage::disk('s3_thumbnails')->url($thumbnailPath); } */ $baseFilename = str_replace('.mp4', '', $video->url); $thumbnailUrls = []; for ($i = 0; $i < $video->no_of_thumbnails; $i++) { $thumbnailUrls[] = Storage::disk('s3_thumbnails')->url("{$baseFilename}" . ($video->no_of_thumbnails > 1 ? "-{$i}" : '') . '.jpg'); } @endphp @if ($video->file_type == 1)
{{--
Video Thumbnail Play Button
--}}
Video Thumbnail Play Button
{{ $video->title }}

{{ $video->description }}

{{ $timeAgoText }}

@endif @if ($video->file_type == 2) @php $thumbnailPath = $video->url; $thumbnailUrl = Storage::disk('s3_thumbnails')->url($thumbnailPath); $imageUrl = $video->signedUrl; $thumbnailPathJpg = pathinfo($thumbnailPath, PATHINFO_DIRNAME) . '/' . pathinfo($thumbnailPath, PATHINFO_FILENAME) . '.jpg'; $thumbnailUrlJpg = Storage::disk('s3_thumbnails')->url($thumbnailPathJpg); $isDocxFile = Str::endsWith($video->url, '.docx'); @endphp @if (!$isDocxFile)
{{-- Document Thumbnail --}} {{-- Document Thumbnail --}}
Document Thumbnail
{{ $video->title }}

{{ $video->description }}

{{ $timeAgoText }}

@elseif ($isDocxFile)
Document Thumbnail
{{ $video->title }}

{{ $video->description }}

{{ $timeAgoText }}

@endif @endif @if ($video->file_type == 3) @php $date = \Carbon\Carbon::parse($video->capture_datetime); $timeAgoText = $date->format('F j, Y'); $thumbnailPath = $video->url; $thumbnailUrl = Storage::disk('s3_thumbnails')->url($thumbnailPath); $extensions = ['jpg', 'jpeg', 'png', 'JPG', 'PNG', 'JPEG']; $thumbnailUrlJpg = null; foreach ($extensions as $ext) { $thumbnailPathWithExt = pathinfo($thumbnailPath, PATHINFO_DIRNAME) . '/' . pathinfo($thumbnailPath, PATHINFO_FILENAME) . '.' . $ext; //if (Storage::disk('s3_thumbnails')->exists($thumbnailPathWithExt)) { $thumbnailUrlJpg = Storage::disk('s3_thumbnails')->url( $thumbnailPathWithExt, ); // break; //} } $imageUrl = $video->signedUrl; @endphp
Video Thumbnail {{-- Play Button --}}
{{ $video->title }}

{{ $timeAgoText }}

@endif @if ($video->file_type == 4)
Document Thumbnail
{{ $video->title }}

{{ $video->description }}

{{ $timeAgoText }}

@endif @endforeach @else

No files found.

@endif