Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 1.47 KB

File metadata and controls

42 lines (26 loc) · 1.47 KB

OgImgGen

Og image generation middleware for .net core with built in caching

Available on nuget package manager Nuget package

.net CLI: dotnet add package OgImgGen --version 1.0.1

Usage example

Query the required og image:

https://localhost:5001/ogimg.png?topText=Hello%20World&bottomText=Dynamically%20generated%20png%20og%20image

Enjoy the result:

Og Image

Setup

Register in the Configure method

app.UseResponseCaching();

app.UseOgImgGen("/ogImg.png", "default-image.png", "font-you-want-to-use.ttf");

UseOgImgGen accepts 3 properties

  • path, the URL to listen to
  • defaultImage location, the location for an existing image
  • font file location, the font to render on image

Query options

query option default value description type
topText first line of the text string?
bottomText second line of the text string?
theme dark defines the background and text color "dark"|"light"
image defaultImage from the UseOgImgGen method a relative path to the image file string?