Next.js Discord

Discord Forum

Opengraph Image generation

Unanswered
Great-tailed Grackle posted this in #help-forum
Open in Discord
Great-tailed GrackleOP
I can't get it working without using edge runtime, but I need to access file system to load a font.


import { ImageResponse } from 'next/og';

export async function GET() {
  return new ImageResponse(
    (
      <div
        style={{
          fontSize: 64,
          background: 'white',
          width: '100%',
          height: '100%',
          display: 'flex',
          alignItems: 'flex-end',
          justifyContent: 'flex-start',
          padding: '6rem',
        }}
      >
        Test
      </div>
    ),
    {
      width: 1200,
      height: 630,
    }
  );
}

0 Replies