feat: convert all to jpg
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { json } from "@sveltejs/kit";
|
||||
import * as Jimp from "jimp";
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { putObject } from "$lib/helpers/minio";
|
||||
import { generateImage } from "$lib/helpers/stability";
|
||||
@ -33,6 +34,11 @@ export const POST: RequestHandler = async ({ params, request }) => {
|
||||
|
||||
await putObject(imageName, Buffer.from(image.base64, 'base64'), { "Content-Type": "image/png" });
|
||||
|
||||
const img = await Jimp.read(Buffer.from(image.base64, "base64"));
|
||||
const jpgBuffer = await img.quality(70).getBufferAsync(Jimp.MIME_JPEG);
|
||||
|
||||
await putObject(imageName.replace(".png", ".jpg"), jpgBuffer, { "Content-Type": "image/jpeg" });
|
||||
|
||||
return json({
|
||||
duration,
|
||||
url: `https://s3-api.app.max-richter.dev/silvester23/${imageName}`
|
||||
|
Reference in New Issue
Block a user