Serve thumbnails in grid instead of full images

This commit is contained in:
Justin Edmund 2025-06-17 12:49:05 +01:00
parent 1867187635
commit d73619aa24

View file

@ -112,7 +112,7 @@ export const GET: RequestHandler = async (event) => {
description: album.description || undefined, description: album.description || undefined,
coverPhoto: { coverPhoto: {
id: `cover-${firstMedia.id}`, id: `cover-${firstMedia.id}`,
src: firstMedia.url, src: firstMedia.thumbnailUrl || firstMedia.url,
alt: firstMedia.photoCaption || album.title, alt: firstMedia.photoCaption || album.title,
caption: firstMedia.photoCaption || undefined, caption: firstMedia.photoCaption || undefined,
width: firstMedia.width || 400, width: firstMedia.width || 400,
@ -120,7 +120,7 @@ export const GET: RequestHandler = async (event) => {
}, },
photos: album.media.map((albumMedia) => ({ photos: album.media.map((albumMedia) => ({
id: `media-${albumMedia.media.id}`, id: `media-${albumMedia.media.id}`,
src: albumMedia.media.url, src: albumMedia.media.thumbnailUrl || albumMedia.media.url,
alt: albumMedia.media.photoCaption || albumMedia.media.filename, alt: albumMedia.media.photoCaption || albumMedia.media.filename,
caption: albumMedia.media.photoCaption || undefined, caption: albumMedia.media.photoCaption || undefined,
width: albumMedia.media.width || 400, width: albumMedia.media.width || 400,
@ -137,7 +137,7 @@ export const GET: RequestHandler = async (event) => {
return { return {
id: `media-${media.id}`, id: `media-${media.id}`,
src: media.url, src: media.thumbnailUrl || media.url,
alt: media.photoTitle || media.photoCaption || media.filename, alt: media.photoTitle || media.photoCaption || media.filename,
caption: media.photoCaption || undefined, caption: media.photoCaption || undefined,
width: media.width || 400, width: media.width || 400,