feat: some updates
All checks were successful
Deploy to SFTP Server / build (push) Successful in 17m5s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 17m5s
This commit is contained in:
@ -19,16 +19,23 @@ export async function generateThumbHash(image: { width: number, height: number }
|
||||
const smallWidth = Math.floor(image.width * scaleFactor);
|
||||
const smallHeight = Math.floor(image.height * scaleFactor);
|
||||
|
||||
//@ts-ignore
|
||||
const smallImg = await sharp(image.fsPath)
|
||||
.resize(smallWidth, smallHeight)
|
||||
.withMetadata()
|
||||
.raw()
|
||||
.ensureAlpha()
|
||||
.toBuffer();
|
||||
try {
|
||||
|
||||
//@ts-ignore
|
||||
const smallImg = await sharp(image.fsPath)
|
||||
.resize(smallWidth, smallHeight)
|
||||
.withMetadata()
|
||||
.raw()
|
||||
.ensureAlpha()
|
||||
.toBuffer();
|
||||
|
||||
const buffer = rgbaToThumbHash(smallWidth, smallHeight, smallImg);
|
||||
return Buffer.from(buffer).toString("base64");
|
||||
} catch (error) {
|
||||
console.log("Could not generate thumbhash", error)
|
||||
return undefined
|
||||
}
|
||||
|
||||
const buffer = rgbaToThumbHash(smallWidth, smallHeight, smallImg);
|
||||
return Buffer.from(buffer).toString("base64");
|
||||
}
|
||||
|
||||
const allowedExif = [
|
||||
|
@ -41,10 +41,6 @@ const list = [...posts, ...photos];
|
||||
list.sort((a, b) => {
|
||||
return a.data.date > b.data.date ? -1 : 1;
|
||||
});
|
||||
// .sort((a, b) => {
|
||||
// return a.data.date.getDate() > b.data.date.getDate() ? 1 : -1;
|
||||
// });
|
||||
console.log(list.map((post) => [post.data.date, post.data.title]));
|
||||
|
||||
const featuredPost = list.find((post) => post.data?.featured);
|
||||
const otherPosts = list.filter((post) => featuredPost !== post).slice(0, 3);
|
||||
|
Reference in New Issue
Block a user