@php
// Use web-optimized version if exists, fallback to original
$picturePath = $data->picture ?? 'noimage.png';
$webOptimizedPath = public_path('storage/' . $picturePath . '_web.jpg');
$imageSrc = file_exists($webOptimizedPath)
? asset('storage/' . $picturePath . '_web.jpg')
: asset('storage/' . $picturePath);
@endphp
{!! !empty($data->description) ? $data->description : '
Tidak Ada Konten
' !!}
{{-- Gallery Slider - Multi Foto Section --}}
@php
// Support both field names: multifoto and gallery_photos
$galleryField = $data->multifoto ?? $data->gallery_photos ?? null;
$gallery = [];
if ($galleryField) {
if (is_string($galleryField)) {
$decoded = json_decode($galleryField, true);
$gallery = is_array($decoded) ? $decoded : [];
} elseif (is_array($galleryField)) {
$gallery = $galleryField;
}
}
$hasGallery = !empty($gallery) && count($gallery) > 0;
@endphp
@if($hasGallery)
@foreach($gallery as $idx => $photo)
@php
// Use web-optimized version if exists, fallback to original
$webOptimizedPath = public_path('storage/' . $photo . '_web.jpg');
$galleryImgSrc = file_exists($webOptimizedPath)
? asset('storage/' . $photo . '_web.jpg')
: asset('storage/' . $photo);
@endphp
@endforeach
@endif
{{-- Video Section --}}
@php
$videoUrl = $data->video_url ?? '';
$isEmbed = $videoUrl && (strpos($videoUrl, 'youtube.com') !== false || strpos($videoUrl, 'youtu.be') !== false || strpos($videoUrl, 'vimeo.com') !== false);
@endphp
@if($videoUrl)
@if($isEmbed)
@else
@endif
@endif