create webp variant

This commit is contained in:
Nimer Farahty 2025-04-19 23:00:32 +03:00
parent 32c9db5c12
commit cb820c47cd

View File

@ -42,7 +42,7 @@ export async function processImage(
thumb, thumb,
thumb.length, thumb.length,
{ {
"Content-Type": "image/jpeg", "Content-Type": mime,
"x-amz-meta-processed": "true", "x-amz-meta-processed": "true",
} }
); );
@ -54,7 +54,19 @@ export async function processImage(
optimized, optimized,
optimized.length, optimized.length,
{ {
"Content-Type": "image/jpeg", "Content-Type": mime,
"x-amz-meta-processed": "true",
}
);
const webp = await sharp(buffer).webp({ quality: 80 }).toBuffer();
await minio.putObject(
bucket,
`${filePath}/webp/${fileName?.replace(/\.[^/.]+$/, ".webp")}`,
webp,
webp.length,
{
"Content-Type": "image/webp",
"x-amz-meta-processed": "true", "x-amz-meta-processed": "true",
} }
); );