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: {
|
||||
url: albumRecord["thumbnail"]["filename_download"],
|
||||
url: albumRecord["thumbnail"]["filename_disk"],
|
||||
width: thumbnailImage.width,
|
||||
height: thumbnailImage.height
|
||||
},
|
||||
|
||||
@@ -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> {
|
||||
@@ -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);
|
||||
@@ -182,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
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user