diff --git a/libs/resize.js b/libs/resize.js index 0f70d9e..7e9241b 100644 --- a/libs/resize.js +++ b/libs/resize.js @@ -19,6 +19,7 @@ class Resize { _resize (input, output, callback) { fs.readFile(input, (err, data) => { + console.log('après readfile') if (err) { callback(err, null) return false @@ -26,7 +27,9 @@ class Resize { resizeImg(data, this.size) .then(buf => { + console.log('then rezise') fs.writeFile(output, buf, (err) => { + console.log('write file') if (err) { callback(err, null) return false diff --git a/middleware/Pictures.js b/middleware/Pictures.js index d9fcd15..1c09430 100644 --- a/middleware/Pictures.js +++ b/middleware/Pictures.js @@ -117,7 +117,7 @@ class Pictures { console.log(e) callback(e, null) }) - fs.unlink(req.file.path, () => {}) + fs.unlink(req.file.path, () => { }) } createOne (req, callback) { @@ -163,9 +163,12 @@ class Pictures { url: res.file } - fs.unlink(large.output, () => {}) + fs.unlink(large.output, () => { }) + + console.log('avant thumb') resize.createThumbnail(req.file.path, (err, file) => { + console.log('après createThumb') if (err) { callback(err, null) return false @@ -175,10 +178,11 @@ class Pictures { path: file.output, filename: `picture_${req.params.vegetablesId}_${key}_thumb.${req.file.originalname.split('.')[req.file.originalname.split('.').length - 1]}` }, (err, res) => { + console.log('après upload') if (err) { callback(err, null) } this._createOne(req, callback) - fs.unlink(file.output, () => {}) + fs.unlink(file.output, () => { }) }) }) })