@php // If a Collection or array was passed accidentally, pick the first item. if (isset($art) && (is_array($art) || $art instanceof Illuminate\Support\Collection || $art instanceof Illuminate\Database\Eloquent\Collection)) { $first = null; if (is_array($art)) { $first = reset($art); } elseif ($art instanceof Illuminate\Support\Collection || $art instanceof Illuminate\Database\Eloquent\Collection) { $first = $art->first(); } if ($first) { $art = $first; } } $title = trim((string) ($art->name ?? $art->title ?? 'Untitled artwork')); $author = trim((string) ($art->uname ?? $art->author_name ?? $art->author ?? 'Skinbase')); $category = trim((string) ($art->category_name ?? $art->category ?? 'General')); $license = trim((string) ($art->license ?? 'Standard')); $resolution = trim((string) ($art->resolution ?? ((isset($art->width, $art->height) && $art->width && $art->height) ? ($art->width . '×' . $art->height) : ''))); $likes = (int) ($art->likes ?? $art->favourites ?? 0); $downloads = (int) ($art->downloads ?? $art->downloaded ?? 0); $img_src = (string) ($art->thumb ?? $art->thumbnail_url ?? '/images/placeholder.jpg'); $img_srcset = (string) ($art->thumb_srcset ?? $art->thumbnail_srcset ?? $img_src); $img_avif_srcset = (string) ($art->thumb_avif_srcset ?? $img_srcset); $img_webp_srcset = (string) ($art->thumb_webp_srcset ?? $img_srcset); $img_width = max(1, (int) ($art->width ?? 800)); $img_height = max(1, (int) ($art->height ?? 600)); $contentUrl = $img_src; $cardUrl = (string) ($art->url ?? '#'); @endphp