diff --git a/src/routes/og.png/+server.ts b/src/routes/og.png/+server.ts
index 8047c33..67b3a1b 100644
--- a/src/routes/og.png/+server.ts
+++ b/src/routes/og.png/+server.ts
@@ -11,66 +11,66 @@ const height = 630;
const width = 1200;
const getImageData = async () => {
- try {
- const imagePath = path.join(process.cwd(), 'src', 'lib', 'assets', 'og', 'me.jpg');
- const meImage = await readFile(imagePath);
- return Buffer.from(meImage).toString('base64');
- } catch (error) {
- console.error('Error reading image:', error);
- throw error;
- }
+ // try {
+ const imagePath = path.join(process.cwd(), 'src', 'lib', 'assets', 'og', 'me.jpg');
+ const meImage = await readFile(imagePath);
+ return Buffer.from(meImage).toString('base64');
+ // } catch (error) {
+ // console.error('Error reading image:', error);
+ // throw error;
+ // }
};
/** @type {import('./$types').RequestHandler} */
export const GET = async ({ url }) => {
- try {
- const title = url.searchParams.get('title') ?? undefined;
- const subTitle = url.searchParams.get('subTitle') ?? undefined;
+ // try {
+ const title = url.searchParams.get('title') ?? undefined;
+ const subTitle = url.searchParams.get('subTitle') ?? undefined;
- const imageData = await getImageData();
+ const imageData = await getImageData();
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const result = (OgImage as any).render({ title, subTitle, imageData });
- const element = toReactNode(`${result.html}`);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const result = (OgImage as any).render({ title, subTitle, imageData });
+ const element = toReactNode(`${result.html}`);
- const svg = await satori(element, {
- fonts: [
- {
- name: 'Geist Regular',
- data: Buffer.from(GeistRegular),
- weight: 100
- },
- {
- name: 'Geist Bold',
- data: Buffer.from(GeistBold),
- weight: 700
- }
- ],
- height,
- width
- });
-
- const resvg = new Resvg(svg, {
- fitTo: {
- mode: 'width',
- value: width
+ const svg = await satori(element, {
+ fonts: [
+ {
+ name: 'Geist Regular',
+ data: Buffer.from(GeistRegular),
+ weight: 100
+ },
+ {
+ name: 'Geist Bold',
+ data: Buffer.from(GeistBold),
+ weight: 700
}
- });
+ ],
+ height,
+ width
+ });
- const image = resvg.render();
+ const resvg = new Resvg(svg, {
+ fitTo: {
+ mode: 'width',
+ value: width
+ }
+ });
- return new Response(image.asPng(), {
- headers: {
- 'content-type': 'image/png'
- }
- });
- } catch (error) {
- console.error('Error generating image:', error);
- return new Response('Internal Server Error', {
- status: 500,
- headers: {
- 'content-type': 'text/plain'
- }
- });
- }
+ const image = resvg.render();
+
+ return new Response(image.asPng(), {
+ headers: {
+ 'content-type': 'image/png'
+ }
+ });
+ // } catch (error) {
+ // console.error('Error generating image:', error);
+ // return new Response('Internal Server Error', {
+ // status: 500,
+ // headers: {
+ // 'content-type': 'text/plain'
+ // }
+ // });
+ // }
};