diff --git a/public/images/userspics/root.png b/public/images/userspics/root.png index 6266fde..0bf778b 100644 Binary files a/public/images/userspics/root.png and b/public/images/userspics/root.png differ diff --git a/routes/upload.js b/routes/upload.js index e6eba26..1f08744 100644 --- a/routes/upload.js +++ b/routes/upload.js @@ -58,7 +58,7 @@ router.post("/", function(req, res, next) { uploadPath = req.headers.uploadforuser+ ".jpg" } - image.mv(__dirname + path.sep + uploadPath, function(err) { + image.mv(__dirname.replace("routes", "") + path.sep + uploadPath, function(err) { if(err) { res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."}) console.log(err) @@ -78,7 +78,10 @@ router.post("/", function(req, res, next) { if(req.files.apic.mimetype == "image/jpeg") { Jimp.read(uploadDir + uploadPath, function (err, image) { image.resize(200,200, function(err){ - if (err) throw err; + if (err) { + + console.log(err) + } }).write(uploadDir + uploadPath.replace("jpg", "png")) fs.rmSync(uploadDir + req.headers.uploadforuser + ".jpg") @@ -93,7 +96,10 @@ router.post("/", function(req, res, next) { } else if(req.files.apic.mimetype == "image/png") { Jimp.read(uploadDir + uploadPath, function (err, image) { image.resize(200,200, function(err){ - if (err) throw err; + if (err) { + + console.log(err) + } }).write(uploadDir + uploadPath) res.send({"result":"success", "content": "La photo de profil a été changé avec succès.",}) @@ -175,7 +181,7 @@ router.post("/", function(req, res, next) { uploadPath = ntr.checkToken(req, res).name + ".jpg" } - image.mv(__dirname + path.sep + uploadPath, function(err) { + image.mv(__dirname.replace("routes", "") + path.sep + uploadPath, function(err) { if(err) { res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."}) console.log(err) @@ -195,7 +201,10 @@ router.post("/", function(req, res, next) { if(req.files.apic.mimetype == "image/jpeg") { Jimp.read(uploadDir + uploadPath, function (err, image) { image.resize(200,200, function(err){ - if (err) throw err; + if (err) { + + console.log(err) + } }).write(uploadDir + uploadPath.replace("jpg", "png")) fs.rmSync(uploadDir + ntr.checkToken(req, res).name + ".jpg") @@ -210,7 +219,10 @@ router.post("/", function(req, res, next) { } else if(req.files.apic.mimetype == "image/png") { Jimp.read(uploadDir + uploadPath, function (err, image) { image.resize(200,200, function(err){ - if (err) throw err; + if (err) { + + console.log(err) + } }).write(uploadDir + uploadPath) res.send({"result":"success", "content": "La photo de profil a été changé avec succès.",}) diff --git a/users/0cee5da6-6812-49d8-97f5-2df5c1d78191.json b/users/0cee5da6-6812-49d8-97f5-2df5c1d78191.json index 5954462..536801c 100644 --- a/users/0cee5da6-6812-49d8-97f5-2df5c1d78191.json +++ b/users/0cee5da6-6812-49d8-97f5-2df5c1d78191.json @@ -9,5 +9,5 @@ "livableToken": true, "createdAt": 1679260759114 }, - "lastconnexion": 1679594782961 + "lastconnexion": 1679595671060 } \ No newline at end of file