@php
// If more than 7 images, only keep the first 7
if ($listingImages->count() > 7) {
$listingImages = $listingImages->take(7);
}
// Define resolveImagePath function for consistency
if (!function_exists('resolveImagePath')) {
function resolveImagePath($img, $folder = 'assets/img/listing-gallery/')
{
if (!$img) return null;
if (Str::startsWith($img, ['http://', 'https://'])) {
if (Str::contains($img, '/download?') && Str::contains($img, 'files=')) {
$parts = explode('files=', $img, 2);
$e