mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-02-03 13:22:05 +02:00
refactoring and temp directory creating
This commit is contained in:
parent
6163dcb7a5
commit
ab3255536e
@ -10,14 +10,9 @@ export class GalleryMWs {
|
|||||||
|
|
||||||
|
|
||||||
public static listDirectory(req:Request, res:Response, next:NextFunction){
|
public static listDirectory(req:Request, res:Response, next:NextFunction){
|
||||||
console.log("listDirectory");
|
let directoryName = req.params.directory || "/";
|
||||||
console.log(req.params);
|
|
||||||
let directoryName = "/";
|
|
||||||
if(req.params.directory){
|
|
||||||
directoryName = req.params.directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
let absoluteDirectoryName = path.join(__dirname,"/../../demo/images", directoryName);
|
let absoluteDirectoryName = path.join(__dirname,"/../../demo/images", directoryName);
|
||||||
|
|
||||||
if(!fs.statSync(absoluteDirectoryName).isDirectory()){
|
if(!fs.statSync(absoluteDirectoryName).isDirectory()){
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,11 @@ export class ThumbnailGeneratorMWs {
|
|||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tmpDir = path.join(__dirname,"/../../demo/TEMP");
|
||||||
|
if (!fs.existsSync(tmpDir)){
|
||||||
|
fs.mkdirSync(tmpDir);
|
||||||
|
}
|
||||||
|
|
||||||
Jimp.read(imagePath).then( (image) => {
|
Jimp.read(imagePath).then( (image) => {
|
||||||
if (image.bitmap.with < image.bitmap.height) {
|
if (image.bitmap.with < image.bitmap.height) {
|
||||||
image.resize(size, Jimp.AUTO); // resize
|
image.resize(size, Jimp.AUTO); // resize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user