Slightly better embeds

This commit is contained in:
Madeline
2022-10-01 15:59:30 +10:00
parent e18af893f6
commit 070ce373e9
2 changed files with 159 additions and 27 deletions
+4
View File
@@ -77,6 +77,10 @@ router.get("/resize/:url", async (req: Request, res: Response) => {
throw new HTTPError("Couldn't fetch website");
}
if (response.headers.get("content-type")?.indexOf("image") === -1) {
throw new HTTPError("Content type is not image.");
}
const resizedBuffer = await sharp(buffer)
.resize(parseInt(width as string), parseInt(height as string), {
fit: "inside",