Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jonathan249/dynamic-og

dynamically generate images on the edge
https://github.com/jonathan249/dynamic-og

Last synced: about 5 hours ago
JSON representation

dynamically generate images on the edge

Awesome Lists containing this project

README

        

# dynamic-og

Dynamically generate images on the edge

Documentation for `generateOgImage` Function The generateOgImage function is a function that accepts an object of type OGFnProps as a parameter and returns an ImageResponse object.

## Usage

```tsx
import { generateOgImage, type GenerateOgImageProps } from 'dynamic-og';

const props: GenerateOgImageProps = {
width: 1200,
height: 630,
debug: false,
children:

Hello World
,
emoji: 'twemoji',
className: 'custom-class',
};

const imageResponse = generateOgImage({ props });
```

## Parameters

The function accepts an object with the following properties:

- ``props``: An object of type OGFnProps with the following properties:
- ``width``: The width of the image.
- ``height``: The height of the image.
- ``debug``: A boolean value indicating whether debug mode is enabled or not.
- ``children``: React nodes to be rendered as children of the image.
- ``emoji``: The type of emoji to use. Can be one of the following values: 'blobmoji', 'fluent', 'fluentFlat', 'noto', 'openmoji', 'twemoji'.
- ``className``: Style the wrapping container of the image respone

## Return Value
The function returns an ImageResponse object that represents the generated image.