mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
code cleanup
This commit is contained in:
parent
88c8d53d49
commit
ba4cad7bef
@ -122,7 +122,6 @@ export class ThumbnailGeneratorMWs {
|
|||||||
//check if thumbnail already exist
|
//check if thumbnail already exist
|
||||||
if (fs.existsSync(thPath) === true) {
|
if (fs.existsSync(thPath) === true) {
|
||||||
return next();
|
return next();
|
||||||
//return setTimeout(()=>{next();},2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//create thumbnail folder if not exist
|
//create thumbnail folder if not exist
|
||||||
@ -130,7 +129,6 @@ export class ThumbnailGeneratorMWs {
|
|||||||
fs.mkdirSync(ProjectPath.ThumbnailFolder);
|
fs.mkdirSync(ProjectPath.ThumbnailFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("generating thumbnail", imagePath, size);
|
|
||||||
//run on other thread
|
//run on other thread
|
||||||
pool.send({imagePath: imagePath, size: size, thPath: thPath})
|
pool.send({imagePath: imagePath, size: size, thPath: thPath})
|
||||||
.on('done', (out) => {
|
.on('done', (out) => {
|
||||||
|
@ -127,11 +127,8 @@ export class ThumbnailLoaderService {
|
|||||||
task.taskEntities.forEach(te => te.listener.onStartedLoading());
|
task.taskEntities.forEach(te => te.listener.onStartedLoading());
|
||||||
task.inProgress = true;
|
task.inProgress = true;
|
||||||
|
|
||||||
console.log("loading", task.gridPhoto.getThumbnailPath());
|
|
||||||
let curImg = new Image();
|
let curImg = new Image();
|
||||||
curImg.onload = () => {
|
curImg.onload = () => {
|
||||||
console.log("loaded", task.gridPhoto.getThumbnailPath());
|
|
||||||
|
|
||||||
task.gridPhoto.thumbnailLoaded();
|
task.gridPhoto.thumbnailLoaded();
|
||||||
this.galleryChacheService.photoUpdated(task.gridPhoto.photo);
|
this.galleryChacheService.photoUpdated(task.gridPhoto.photo);
|
||||||
task.taskEntities.forEach((te: ThumbnailTaskEntity) => te.listener.onLoad());
|
task.taskEntities.forEach((te: ThumbnailTaskEntity) => te.listener.onLoad());
|
||||||
@ -142,7 +139,6 @@ export class ThumbnailLoaderService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
curImg.onerror = (error) => {
|
curImg.onerror = (error) => {
|
||||||
console.log("error", task.gridPhoto.getThumbnailPath());
|
|
||||||
task.taskEntities.forEach((te: ThumbnailTaskEntity) => te.listener.onError(error));
|
task.taskEntities.forEach((te: ThumbnailTaskEntity) => te.listener.onError(error));
|
||||||
|
|
||||||
this.taskReady(task);
|
this.taskReady(task);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user