diff --git a/process-image.ts b/process-image.ts index 15023aa..fab1b60 100644 --- a/process-image.ts +++ b/process-image.ts @@ -42,7 +42,7 @@ export async function processImage( thumb, thumb.length, { - "Content-Type": "image/jpeg", + "Content-Type": mime, "x-amz-meta-processed": "true", } ); @@ -54,7 +54,19 @@ export async function processImage( optimized, 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", } );