File tree 1 file changed +4
-9
lines changed
opengraph-image-runtimes/src/app
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 1
1
// Based on: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#generate-images-using-code-js-ts-tsx
2
2
3
3
import { ImageResponse } from "next/og" ;
4
- import { readFile } from "node:fs/promises" ;
5
- import { join } from "node:path" ;
6
4
7
5
// Image metadata
8
6
export const alt = "About Acme" ;
@@ -13,16 +11,13 @@ export const size = {
13
11
14
12
export const contentType = "image/png" ;
15
13
16
- export const runtime = "nodejs" ; // Explicitly set
17
-
18
- // Font loading, process.cwd() is Next.js project directory
19
- const geistSemiBold = readFile (
20
- join ( process . cwd ( ) , "src/assets/Geist-SemiBold.ttf" )
21
- ) ;
14
+ export const runtime = "edge" ; // Explicitly set
22
15
23
16
// Image generation
24
17
export default async function Image ( ) {
25
- const geistSemiBoldData = await geistSemiBold ;
18
+ const geistSemiBoldData = await fetch (
19
+ new URL ( "../assets/Geist-SemiBold.ttf" , import . meta. url )
20
+ ) . then ( ( r ) => r . arrayBuffer ( ) ) ;
26
21
27
22
return new ImageResponse (
28
23
(
You can’t perform that action at this time.
0 commit comments