feat: convert all to jpg

This commit is contained in:
2023-11-13 02:53:21 +01:00
parent 355c195c27
commit 72a60f1da5
6 changed files with 623 additions and 10 deletions

View File

@ -10,7 +10,7 @@
<img src="/hang.png" class="hang" />
<picture>
<source srcset={src.replace('.png', '.jpg')} type="image/jpeg" />
<img {src} alt={src} />
<img {src} {alt} />
</picture>
</div>

View File

@ -202,7 +202,7 @@
{/if}
{#if $data.adelsTitel && $data.adelsTitelAccepted && $data.providePortrait !== false}
<section transition:slide>
<section transition:slide class="portrait-frame" class:loaded={!!$data.portraitUrl}>
{#if $data.providePortrait === undefined}
<TextSplit
content="Sollten unsere begabten Künstler ein majestätisches Porträt von Euch anfertigen?"
@ -296,16 +296,25 @@
font-size: 2em;
margin-bottom: 200px;
}
.portrait-frame {
margin-top: 100px;
}
.portrait-frame.loaded {
border: none;
}
button {
border: none;
border-radius: 9px;
border-radius: 5px;
padding: 5px 9px;
margin-right: 10px;
background: #d0a75c;
border: solid thin gold;
box-shadow: 3px 3px 8px white inset;
background: #866831;
box-shadow: 3px 3px 8px #e1b45f inset;
cursor: pointer;
}
.wrapper {
display: flex;
flex-direction: column;

View File

@ -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}`