const sharp = require("sharp");

async function makeDetailWebp(inputBuffer) {
  return sharp(inputBuffer)
    .rotate()
    .resize({ width: 1200, withoutEnlargement: true })
    .webp({ quality: 80 })
    .toBuffer();
}

async function makeThumbWebp(inputBuffer) {
  return sharp(inputBuffer)
    .rotate()
    .resize({ width: 400, withoutEnlargement: true })
    .webp({ quality: 75 })
    .toBuffer();
}

module.exports = { makeDetailWebp, makeThumbWebp };
