Skip to content

Commit

Permalink
feat: add alternative open graph endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
blasferna committed Jul 11, 2023
1 parent 5fd0ca8 commit 7d948bc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,21 @@ async def tts(text, lang="en"):


@app.get(
"/generate-og-image/{title}/{sitename}/{tag}/image.png",
"/og-image",
responses={200: {"content": {"image/png": {}}}},
response_class=Response,
)
async def create_og_image(title: str, sitename: str, tag: str):
image = generate_og_image(title, sitename, tag=tag)
return Response(image.read(), media_type="image/png")


@app.get(
"/generate-og-image/{title}/{sitename}/{tag}/image.png",
responses={200: {"content": {"image/png": {}}}},
response_class=Response,
)
async def create_og_image_v2(title: str, sitename: str, tag: str):
image = generate_og_image(title, sitename, tag=tag)
return Response(image.read(), media_type="image/png")

0 comments on commit 7d948bc

Please sign in to comment.