Fix Link Image #2
This commit is contained in:
parent
493b6973c5
commit
d2f3c3c32f
Binary file not shown.
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 17 KiB |
@ -58,7 +58,7 @@ router.post("/", function(req, res, next) {
|
|||||||
uploadPath = req.headers.uploadforuser+ ".jpg"
|
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) {
|
if(err) {
|
||||||
res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
|
res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
|
||||||
console.log(err)
|
console.log(err)
|
||||||
@ -78,7 +78,10 @@ router.post("/", function(req, res, next) {
|
|||||||
if(req.files.apic.mimetype == "image/jpeg") {
|
if(req.files.apic.mimetype == "image/jpeg") {
|
||||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||||
image.resize(200,200, function(err){
|
image.resize(200,200, function(err){
|
||||||
if (err) throw err;
|
if (err) {
|
||||||
|
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
}).write(uploadDir + uploadPath.replace("jpg", "png"))
|
}).write(uploadDir + uploadPath.replace("jpg", "png"))
|
||||||
fs.rmSync(uploadDir + req.headers.uploadforuser + ".jpg")
|
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") {
|
} else if(req.files.apic.mimetype == "image/png") {
|
||||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||||
image.resize(200,200, function(err){
|
image.resize(200,200, function(err){
|
||||||
if (err) throw err;
|
if (err) {
|
||||||
|
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
}).write(uploadDir + uploadPath)
|
}).write(uploadDir + uploadPath)
|
||||||
|
|
||||||
res.send({"result":"success", "content": "<span style='color:rgb(130, 255, 163);'>La photo de profil a été changé avec succès.</span>",})
|
res.send({"result":"success", "content": "<span style='color:rgb(130, 255, 163);'>La photo de profil a été changé avec succès.</span>",})
|
||||||
@ -175,7 +181,7 @@ router.post("/", function(req, res, next) {
|
|||||||
uploadPath = ntr.checkToken(req, res).name + ".jpg"
|
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) {
|
if(err) {
|
||||||
res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
|
res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
|
||||||
console.log(err)
|
console.log(err)
|
||||||
@ -195,7 +201,10 @@ router.post("/", function(req, res, next) {
|
|||||||
if(req.files.apic.mimetype == "image/jpeg") {
|
if(req.files.apic.mimetype == "image/jpeg") {
|
||||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||||
image.resize(200,200, function(err){
|
image.resize(200,200, function(err){
|
||||||
if (err) throw err;
|
if (err) {
|
||||||
|
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
}).write(uploadDir + uploadPath.replace("jpg", "png"))
|
}).write(uploadDir + uploadPath.replace("jpg", "png"))
|
||||||
fs.rmSync(uploadDir + ntr.checkToken(req, res).name + ".jpg")
|
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") {
|
} else if(req.files.apic.mimetype == "image/png") {
|
||||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||||
image.resize(200,200, function(err){
|
image.resize(200,200, function(err){
|
||||||
if (err) throw err;
|
if (err) {
|
||||||
|
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
}).write(uploadDir + uploadPath)
|
}).write(uploadDir + uploadPath)
|
||||||
|
|
||||||
res.send({"result":"success", "content": "<span style='color:rgb(130, 255, 163);'>La photo de profil a été changé avec succès.</span>",})
|
res.send({"result":"success", "content": "<span style='color:rgb(130, 255, 163);'>La photo de profil a été changé avec succès.</span>",})
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
"livableToken": true,
|
"livableToken": true,
|
||||||
"createdAt": 1679260759114
|
"createdAt": 1679260759114
|
||||||
},
|
},
|
||||||
"lastconnexion": 1679594782961
|
"lastconnexion": 1679595671060
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user