remove preview

This commit is contained in:
lesion
2022-05-09 17:16:09 +02:00
parent fd0676e283
commit be9c75c088
2 changed files with 2 additions and 11 deletions

View File

@@ -352,7 +352,6 @@ const eventController = {
focalpoint = [parseFloat(focalpoint[0]).toFixed(2), parseFloat(focalpoint[1]).toFixed(2)] focalpoint = [parseFloat(focalpoint[0]).toFixed(2), parseFloat(focalpoint[1]).toFixed(2)]
eventDetails.media = [{ eventDetails.media = [{
url: req.file.filename, url: req.file.filename,
preview: req.file.preview,
height: req.file.height, height: req.file.height,
width: req.file.width, width: req.file.width,
name: body.image_name || body.title || '', name: body.image_name || body.title || '',
@@ -446,9 +445,8 @@ const eventController = {
const focalpoint = body.image_focalpoint ? body.image_focalpoint.split(',') : ['0', '0'] const focalpoint = body.image_focalpoint ? body.image_focalpoint.split(',') : ['0', '0']
eventDetails.media = [{ eventDetails.media = [{
url: req.file.filename, url: req.file.filename,
preview: req.file?.preview, height: req.file.height,
height: req.file?.height, width: req.file.width,
width: req.file?.width,
name: body.image_name || body.title || '', name: body.image_name || body.title || '',
focalpoint: [parseFloat(focalpoint[0].slice(0, 6)), parseFloat(focalpoint[1].slice(0, 6))] focalpoint: [parseFloat(focalpoint[0].slice(0, 6)), parseFloat(focalpoint[1].slice(0, 6))]
}] }]

View File

@@ -17,18 +17,12 @@ const DiskStorage = {
const promises = [ const promises = [
sharpStream.clone().resize(500, null, { withoutEnlargement: true }).jpeg({ mozjpeg: true, progressive: true }).toFile(path.resolve(config.upload_path, 'thumb', filename + '.jpg')), sharpStream.clone().resize(500, null, { withoutEnlargement: true }).jpeg({ mozjpeg: true, progressive: true }).toFile(path.resolve(config.upload_path, 'thumb', filename + '.jpg')),
sharpStream.clone().resize(1200, null, { withoutEnlargement: true } ).jpeg({ quality: 95, mozjpeg: true, progressive: true }).toFile(path.resolve(config.upload_path, filename + '.jpg')), sharpStream.clone().resize(1200, null, { withoutEnlargement: true } ).jpeg({ quality: 95, mozjpeg: true, progressive: true }).toFile(path.resolve(config.upload_path, filename + '.jpg')),
sharpStream.clone()
.resize(5)
.png({ quality: 10, palette: true, effort: 6})
.toBuffer()
.then(buffer => buffer.toString('base64'))
] ]
file.stream.pipe(sharpStream) file.stream.pipe(sharpStream)
Promise.all(promises) Promise.all(promises)
.then(res => { .then(res => {
const info = res[1] const info = res[1]
const preview = res[2]
cb(null, { cb(null, {
destination: config.upload_path, destination: config.upload_path,
filename: filename + '.jpg', filename: filename + '.jpg',
@@ -36,7 +30,6 @@ const DiskStorage = {
height: info.height, height: info.height,
width: info.width, width: info.width,
size: info.size, size: info.size,
preview
}) })
}) })
.catch(err => { .catch(err => {