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

@@ -69,14 +69,14 @@ module.exports = {
async getImageFromURL (url) {
debug(`getImageFromURL ${url}`)
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).jpg({ quality: 95 })
const thumbnailer = sharp().resize(400).jpg({ quality: 90 })
const response = await axios({ method: 'GET', url, responseType: 'stream' })