diff --git a/web/src/lib/components/album-page/album-card.svelte b/web/src/lib/components/album-page/album-card.svelte index 976a59fa85..14fd7f7570 100644 --- a/web/src/lib/components/album-page/album-card.svelte +++ b/web/src/lib/components/album-page/album-card.svelte @@ -7,20 +7,20 @@ export let album: AlbumResponseDto; - let imageData: string = '/no-thumbnail.png'; + let imageData: string = `/api/asset/thumbnail/${album.albumThumbnailAssetId}?format=${ThumbnailFormat.Webp}`; const dispatch = createEventDispatcher(); const loadHighQualityThumbnail = async (thubmnailId: string | null) => { if (thubmnailId == null) { - return '/no-thumbnail.png'; + return; } const { data } = await api.assetApi.getAssetThumbnail(thubmnailId!, ThumbnailFormat.Jpeg, { responseType: 'blob' }); + if (data instanceof Blob) { - imageData = URL.createObjectURL(data); - return imageData; + return URL.createObjectURL(data); } }; @@ -30,6 +30,10 @@ y: e.clientY }); }; + + onMount(async () => { + imageData = await loadHighQualityThumbnail(album.albumThumbnailAssetId) || 'no-thumbnail.png'; + });