2 Commits

Author SHA1 Message Date
itsfinniii
b304cc400c Fix thumbnail size for the album 2026-04-27 17:24:08 +02:00
itsfinniii
79e343dbdc Add some comments 2026-04-27 17:11:11 +02:00
3 changed files with 27 additions and 4 deletions

View File

@@ -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
},

View File

@@ -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<PageType | null> {
@@ -97,8 +97,11 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
const allCategories = await getAllCategories(settings);
const lastCategory = allCategories[0];
// Changing the thumbnail here is okay, as it gets everything again in the CategoryIndex.astro file.
// Might have to make it prettier down the line?
// TODO: See comment above.
const resizedThumbnail = getImageSize(lastCategory.thumbnail.width, lastCategory.thumbnail.height, 0.756);
const thumbnail = await getImage({
src: lastCategory.thumbnail.url,
width: resizedThumbnail.width,
@@ -136,6 +139,9 @@ 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 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);
const thumbnail = await getImage({
@@ -175,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
}
};

View File

@@ -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
}}}>
<Fragment slot="content">
<AlbumPage page={page.page} />