diff --git a/astro/src/content/photos/albums.ts b/astro/src/content/photos/albums.ts index 972f296..f0a239d 100644 --- a/astro/src/content/photos/albums.ts +++ b/astro/src/content/photos/albums.ts @@ -135,7 +135,7 @@ export async function getAlbum(settings: GlobalSettings, route: string): Promise } }, thumbnail: { - url: albumRecord["thumbnail"]["filename_download"], + url: albumRecord["thumbnail"]["filename_disk"], width: thumbnailImage.width, height: thumbnailImage.height }, diff --git a/astro/src/lib/pages.ts b/astro/src/lib/pages.ts index 5b462b7..f71adf1 100644 --- a/astro/src/lib/pages.ts +++ b/astro/src/lib/pages.ts @@ -4,7 +4,7 @@ import { getAlbum } from "@/content/photos/albums"; import { getAllCategories, getPhotoCategory } from "@/content/photos/categories"; import { getPhotoFromHash } from "@/content/photos/photos"; import { getProject } from "@/content/projects/projects"; -import { getImageSize } from "./images"; +import { getImageSize, getImageUrl } from "./images"; import { getImage } from "astro:assets"; export async function getPage(settings: GlobalSettings, route: string): Promise { @@ -139,7 +139,7 @@ export async function getPage(settings: GlobalSettings, route: string): Promise< const category = await getPhotoCategory(`/${params["C"]}`); - // Changing the thumbnail here is okay, as it gets everything again in the CategoryIndex.astro file. + // Changing the thumbnail here is okay, as it gets everything again in the Category.astro file. // Might have to make it prettier down the line? // TODO: See comment above. const resizedThumbnail = getImageSize(category.thumbnail.width, category.thumbnail.height, 0.756); @@ -181,12 +181,29 @@ export async function getPage(settings: GlobalSettings, route: string): Promise< }); const photoAlbum = await getAlbum(settings, `/${params["R"]}`); + + // Changing the thumbnail here is okay, as the thumbnail is unused in the Album.astro file. + // Might have to make it prettier down the line? + // TODO: See comment above. + const resizedThumbnail = getImageSize(photoAlbum.thumbnail.width, photoAlbum.thumbnail.height, 0.756); + + const thumbnail = await getImage({ + src: getImageUrl(photoAlbum.thumbnail.url), + width: resizedThumbnail.width, + height: resizedThumbnail.height, + format: "jpeg" + }); return { route: route, pageType: "PhotoAlbum", page: { ...photoAlbum, + thumbnail: { + url: `${settings.website.domainName}${thumbnail.src}`, + width: resizedThumbnail.width, + height: resizedThumbnail.height + }, pageNumber: params["page"] !== undefined ? Number(params['page']) : 1 } }; diff --git a/astro/src/pages/[...route].astro b/astro/src/pages/[...route].astro index 199a1cf..70016d3 100644 --- a/astro/src/pages/[...route].astro +++ b/astro/src/pages/[...route].astro @@ -154,7 +154,7 @@ if (page === null || page.page === null || !page.page.exists) { allowCrawlers: true, canonical: null, priority: 65, - thumbnail: page.page.category.thumbnail + thumbnail: page.page.thumbnail }}}>