readme zu markdown
parent
f2cb77dac7
commit
bb7f0ce9f3
140
app.js
140
app.js
|
|
@ -125,43 +125,43 @@ server.get('/getonepic-norefresh', async function (req, res) {
|
|||
})
|
||||
|
||||
|
||||
server.get('/getonepic-old', async function (req, res) {
|
||||
fs.readdir(sliderpath, function (err, files) {
|
||||
if (err) {
|
||||
res.status(500).send("Unable to scan directory: " + err)
|
||||
return console.log('Unable to scan directory: ' + err)
|
||||
}
|
||||
console.log(files.length)
|
||||
let newpictureliststr = ""
|
||||
files.forEach(function (file) {
|
||||
newpictureliststr += file
|
||||
})
|
||||
console.log(pictureliststr)
|
||||
console.log(newpictureliststr)
|
||||
if (pictureliststr != newpictureliststr) {
|
||||
console.log("New files in folder")
|
||||
picturelist = files
|
||||
count = files.length
|
||||
counter = 0
|
||||
pictureliststr = newpictureliststr
|
||||
}
|
||||
if (count == 0) {
|
||||
console.log("Empty directory");
|
||||
return res.status(500).send("Empty directory")
|
||||
}
|
||||
if (counter == count) {
|
||||
console.log("Starting over")
|
||||
counter = 0
|
||||
}
|
||||
let currcounter = counter
|
||||
counter++
|
||||
// res.set("Content-Disposition", 'attachment; filename="picture.png"')
|
||||
// res.set("Content-Disposition", 'inline; filename="picture.png"')
|
||||
// res.setHeader('content-type', 'image/jpeg')
|
||||
return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter], { headers: { 'Content-Type': 'image/jpeg' } })
|
||||
// server.get('/getonepic-old', async function (req, res) {
|
||||
// fs.readdir(sliderpath, function (err, files) {
|
||||
// if (err) {
|
||||
// res.status(500).send("Unable to scan directory: " + err)
|
||||
// return console.log('Unable to scan directory: ' + err)
|
||||
// }
|
||||
// console.log(files.length)
|
||||
// let newpictureliststr = ""
|
||||
// files.forEach(function (file) {
|
||||
// newpictureliststr += file
|
||||
// })
|
||||
// console.log(pictureliststr)
|
||||
// console.log(newpictureliststr)
|
||||
// if (pictureliststr != newpictureliststr) {
|
||||
// console.log("New files in folder")
|
||||
// picturelist = files
|
||||
// count = files.length
|
||||
// counter = 0
|
||||
// pictureliststr = newpictureliststr
|
||||
// }
|
||||
// if (count == 0) {
|
||||
// console.log("Empty directory");
|
||||
// return res.status(500).send("Empty directory")
|
||||
// }
|
||||
// if (counter == count) {
|
||||
// console.log("Starting over")
|
||||
// counter = 0
|
||||
// }
|
||||
// let currcounter = counter
|
||||
// counter++
|
||||
// // res.set("Content-Disposition", 'attachment; filename="picture.png"')
|
||||
// // res.set("Content-Disposition", 'inline; filename="picture.png"')
|
||||
// // res.setHeader('content-type', 'image/jpeg')
|
||||
// return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter], { headers: { 'Content-Type': 'image/jpeg' } })
|
||||
|
||||
})
|
||||
})
|
||||
// })
|
||||
// })
|
||||
|
||||
server.get('/get4pic/:id', async function (req, res) {
|
||||
let currid = req.params.id
|
||||
|
|
@ -200,41 +200,41 @@ server.get('/get4pic/:id', async function (req, res) {
|
|||
})
|
||||
|
||||
|
||||
server.get('/getonepic-test', async function (req, res) {
|
||||
fs.readdir(sliderpath, function (err, files) {
|
||||
if (err) {
|
||||
res.status(500).send("Unable to scan directory: " + err)
|
||||
return console.log('Unable to scan directory: ' + err)
|
||||
}
|
||||
console.log(files.length)
|
||||
let newpictureliststr = ""
|
||||
files.forEach(function (file) {
|
||||
newpictureliststr += file
|
||||
})
|
||||
console.log(pictureliststr)
|
||||
console.log(newpictureliststr)
|
||||
if (pictureliststr != newpictureliststr) {
|
||||
console.log("New files in folder")
|
||||
picturelist = files
|
||||
count = files.length
|
||||
counter = 0
|
||||
pictureliststr = newpictureliststr
|
||||
}
|
||||
if (count == 0) {
|
||||
console.log("Empty directory");
|
||||
return res.status(500).send("Empty directory")
|
||||
}
|
||||
if (counter == count) {
|
||||
console.log("Starting over")
|
||||
counter = 0
|
||||
}
|
||||
let currcounter = counter
|
||||
counter++
|
||||
res.set("Content-Disposition", 'attachment; filename="picture.png"')
|
||||
return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter])
|
||||
// server.get('/getonepic-test', async function (req, res) {
|
||||
// fs.readdir(sliderpath, function (err, files) {
|
||||
// if (err) {
|
||||
// res.status(500).send("Unable to scan directory: " + err)
|
||||
// return console.log('Unable to scan directory: ' + err)
|
||||
// }
|
||||
// console.log(files.length)
|
||||
// let newpictureliststr = ""
|
||||
// files.forEach(function (file) {
|
||||
// newpictureliststr += file
|
||||
// })
|
||||
// console.log(pictureliststr)
|
||||
// console.log(newpictureliststr)
|
||||
// if (pictureliststr != newpictureliststr) {
|
||||
// console.log("New files in folder")
|
||||
// picturelist = files
|
||||
// count = files.length
|
||||
// counter = 0
|
||||
// pictureliststr = newpictureliststr
|
||||
// }
|
||||
// if (count == 0) {
|
||||
// console.log("Empty directory");
|
||||
// return res.status(500).send("Empty directory")
|
||||
// }
|
||||
// if (counter == count) {
|
||||
// console.log("Starting over")
|
||||
// counter = 0
|
||||
// }
|
||||
// let currcounter = counter
|
||||
// counter++
|
||||
// res.set("Content-Disposition", 'attachment; filename="picture.png"')
|
||||
// return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter])
|
||||
|
||||
})
|
||||
})
|
||||
// })
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue