resize image to 'small_' and medium version (and delete the orginal)
This commit is contained in:
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user