fix: image transforms via Sharp, model photos crash, video duration
- Backend: add Sharp image transform endpoint (/assets/:id?transform=X) with presets: mini(64), thumbnail(200), preview(480), medium(960), banner(1280) Transformed images are cached as webp next to originals - Frontend: fix model photos crash (p.directus_files_id → p) - Frontend: fix model banner URL (data.model.banner.id → data.model.banner) - Frontend: fix video duration display (video.movie.duration → video.movie_file?.duration) across models/[slug], videos, videos/[slug], and home pages Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,9 +22,9 @@ const { data } = $props();
|
||||
|
||||
let images = $derived(
|
||||
data.model.photos.map((p) => ({
|
||||
...p.directus_files_id,
|
||||
url: getAssetUrl(p.directus_files_id.id),
|
||||
thumbnail: getAssetUrl(p.directus_files_id.id, "thumbnail"),
|
||||
...p,
|
||||
url: getAssetUrl(p.id),
|
||||
thumbnail: getAssetUrl(p.id, "thumbnail"),
|
||||
})),
|
||||
);
|
||||
|
||||
@@ -52,7 +52,7 @@ let totalPlays = $derived(
|
||||
<div class="relative h-64 md:h-80 overflow-hidden bg-gradient-to-br from-primary to-accent">
|
||||
{#if data.model.banner}
|
||||
<img
|
||||
src={getAssetUrl(data.model.banner.id, "banner")}
|
||||
src={getAssetUrl(data.model.banner, "banner")}
|
||||
alt={$_(data.model.artist_name)}
|
||||
class="w-full h-full object-cover"
|
||||
/>
|
||||
@@ -243,7 +243,7 @@ let totalPlays = $derived(
|
||||
<div
|
||||
class="absolute bottom-2 left-2 text-white text-sm font-medium"
|
||||
>
|
||||
{formatVideoDuration(video.movie.duration)}
|
||||
{#if video.movie_file?.duration}{formatVideoDuration(video.movie_file.duration)}{/if}
|
||||
</div>
|
||||
<!-- <div
|
||||
class="absolute top-2 right-2 bg-black/50 text-white text-xs px-2 py-1 rounded-full"
|
||||
|
||||
Reference in New Issue
Block a user