Fix thumbnail size for the album
This commit is contained in:
@@ -135,7 +135,7 @@ export async function getAlbum(settings: GlobalSettings, route: string): Promise
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: albumRecord["thumbnail"]["filename_download"],
|
url: albumRecord["thumbnail"]["filename_disk"],
|
||||||
width: thumbnailImage.width,
|
width: thumbnailImage.width,
|
||||||
height: thumbnailImage.height
|
height: thumbnailImage.height
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { getAlbum } from "@/content/photos/albums";
|
|||||||
import { getAllCategories, getPhotoCategory } from "@/content/photos/categories";
|
import { getAllCategories, getPhotoCategory } from "@/content/photos/categories";
|
||||||
import { getPhotoFromHash } from "@/content/photos/photos";
|
import { getPhotoFromHash } from "@/content/photos/photos";
|
||||||
import { getProject } from "@/content/projects/projects";
|
import { getProject } from "@/content/projects/projects";
|
||||||
import { getImageSize } from "./images";
|
import { getImageSize, getImageUrl } from "./images";
|
||||||
import { getImage } from "astro:assets";
|
import { getImage } from "astro:assets";
|
||||||
|
|
||||||
export async function getPage(settings: GlobalSettings, route: string): Promise<PageType | null> {
|
export async function getPage(settings: GlobalSettings, route: string): Promise<PageType | null> {
|
||||||
@@ -139,7 +139,7 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
|
|||||||
|
|
||||||
const category = await getPhotoCategory(`/${params["C"]}`);
|
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?
|
// Might have to make it prettier down the line?
|
||||||
// TODO: See comment above.
|
// TODO: See comment above.
|
||||||
const resizedThumbnail = getImageSize(category.thumbnail.width, category.thumbnail.height, 0.756);
|
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"]}`);
|
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 {
|
return {
|
||||||
route: route,
|
route: route,
|
||||||
pageType: "PhotoAlbum",
|
pageType: "PhotoAlbum",
|
||||||
page: {
|
page: {
|
||||||
...photoAlbum,
|
...photoAlbum,
|
||||||
|
thumbnail: {
|
||||||
|
url: `${settings.website.domainName}${thumbnail.src}`,
|
||||||
|
width: resizedThumbnail.width,
|
||||||
|
height: resizedThumbnail.height
|
||||||
|
},
|
||||||
pageNumber: params["page"] !== undefined ? Number(params['page']) : 1
|
pageNumber: params["page"] !== undefined ? Number(params['page']) : 1
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ if (page === null || page.page === null || !page.page.exists) {
|
|||||||
allowCrawlers: true,
|
allowCrawlers: true,
|
||||||
canonical: null,
|
canonical: null,
|
||||||
priority: 65,
|
priority: 65,
|
||||||
thumbnail: page.page.category.thumbnail
|
thumbnail: page.page.thumbnail
|
||||||
}}}>
|
}}}>
|
||||||
<Fragment slot="content">
|
<Fragment slot="content">
|
||||||
<AlbumPage page={page.page} />
|
<AlbumPage page={page.page} />
|
||||||
|
|||||||
Reference in New Issue
Block a user