resize image to 'small_' and medium version (and delete the orginal)

This commit is contained in:
paoloar77
2021-12-21 18:12:28 +01:00
parent d6e571edbf
commit cbac34bc0e
6 changed files with 389 additions and 26 deletions

View File

@@ -1966,9 +1966,25 @@ module.exports = {
}
},
delete(path, callback) {
extractFileName: function (filename) {
return path.basename(filename)
},
fs.unlink(path, function(err) {
extractFilePath: function (filename) {
return path.dirname(filename)
},
delete(mypath, alsothumb, callback) {
fs.unlink(mypath, function(err) {
if (alsothumb) {
try {
let img_small = path.dirname(mypath) + '/' + server_constants.PREFIX_IMG_SMALL + path.basename(mypath);
fs.unlink(img_small, () => {});
} catch (e) {
console.error(err);
}
}
if (err) {
console.error(err);
callback(err);
@@ -1979,7 +1995,6 @@ module.exports = {
},
mkdirpath(dirPath) {
// if (!fs.accessSync(dirPath, fs.constants.R_OK | fs.constants.W_OK)) {
if (!fs.existsSync(dirPath)) {
try {
fs.mkdirSync(dirPath, {recursive: true});