Added debug mode

This commit is contained in:
dbroqua 2019-03-12 23:00:37 +01:00
parent 43a5234ab3
commit 1406f4645b
2 changed files with 10 additions and 3 deletions

View file

@ -19,6 +19,7 @@ class Resize {
_resize (input, output, callback) { _resize (input, output, callback) {
fs.readFile(input, (err, data) => { fs.readFile(input, (err, data) => {
console.log('après readfile')
if (err) { if (err) {
callback(err, null) callback(err, null)
return false return false
@ -26,7 +27,9 @@ class Resize {
resizeImg(data, this.size) resizeImg(data, this.size)
.then(buf => { .then(buf => {
console.log('then rezise')
fs.writeFile(output, buf, (err) => { fs.writeFile(output, buf, (err) => {
console.log('write file')
if (err) { if (err) {
callback(err, null) callback(err, null)
return false return false

View file

@ -165,7 +165,10 @@ class Pictures {
fs.unlink(large.output, () => { }) fs.unlink(large.output, () => { })
console.log('avant thumb')
resize.createThumbnail(req.file.path, (err, file) => { resize.createThumbnail(req.file.path, (err, file) => {
console.log('après createThumb')
if (err) { if (err) {
callback(err, null) callback(err, null)
return false return false
@ -175,6 +178,7 @@ class Pictures {
path: file.output, path: file.output,
filename: `picture_${req.params.vegetablesId}_${key}_thumb.${req.file.originalname.split('.')[req.file.originalname.split('.').length - 1]}` filename: `picture_${req.params.vegetablesId}_${key}_thumb.${req.file.originalname.split('.')[req.file.originalname.split('.').length - 1]}`
}, (err, res) => { }, (err, res) => {
console.log('après upload')
if (err) { callback(err, null) } if (err) { callback(err, null) }
this._createOne(req, callback) this._createOne(req, callback)