back to jpeg

This commit is contained in:
les
2020-07-08 23:02:08 +02:00
parent 5a5c62efb4
commit fe4ed2cde7
5 changed files with 93 additions and 109 deletions

View File

@@ -14,14 +14,14 @@ try {
const DiskStorage = {
_handleFile (req, file, cb) {
const filename = crypto.randomBytes(16).toString('hex') + '.webp'
const filename = crypto.randomBytes(16).toString('hex') + '.jpg'
const finalPath = path.resolve(config.upload_path, filename)
const thumbPath = path.resolve(config.upload_path, 'thumb', filename)
const outStream = fs.createWriteStream(finalPath)
const thumbStream = fs.createWriteStream(thumbPath)
const resizer = sharp().resize(1200).webp({ quality: 95 })
const thumbnailer = sharp().resize(400).webp({ quality: 90 })
const resizer = sharp().resize(1200).jpeg({ quality: 95 })
const thumbnailer = sharp().resize(400).jpeg({ quality: 90 })
let onError = false
const err = e => {
if (onError) {