feat(don): automatically downscale images
Build and Push Image / build-backend (push) Successful in 2m33s
Build and Push Image / build-frontend (push) Successful in 4m32s
Build and Push Image / push (push) Successful in 9m16s

This commit is contained in:
2026-06-29 11:36:50 +07:00 Unverified
parent 599e95c934
commit 6d85f74c48
3 changed files with 12 additions and 10 deletions
+8 -1
View File
@@ -191,13 +191,20 @@ export default async function () {
const { name, amount, message, image } = $;
const downscaled = image
? await new Bun.Image(await image.arrayBuffer())
.resize(512, 512)
.webp()
.toBuffer()
: undefined;
const [{ id }] = await tx
.insert(donations)
.values({
name,
amount,
message,
image: image ? Buffer.from(await image.arrayBuffer()) : undefined,
image: downscaled,
uid: $.artifact === "true" ? $.uid : null,
// dont send on screen if less than 10
sent: $.amount < 10,