|
|
|
|
@@ -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,6 +97,9 @@ 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({
|
|
|
|
|
@@ -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({
|
|
|
|
|
@@ -176,11 +182,28 @@ 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
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|