From 16f1afdf10061f1b604ae54100d7161a2b1e2acf Mon Sep 17 00:00:00 2001 From: Braun Patrik Date: Thu, 22 Jun 2017 22:07:47 +0200 Subject: [PATCH] null image error fix --- backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts | 4 ++-- .../gallery/grid/photo/photo.grid.gallery.component.html | 2 +- .../gallery/grid/photo/photo.grid.gallery.component.ts | 9 +++++++++ package.json | 2 -- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts index 11ea0b04..6cd23b2a 100644 --- a/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts +++ b/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.ts @@ -25,9 +25,8 @@ export class ThumbnailGeneratorMWs { return } - Config.Client.concurrentThumbnailGenerations = Math.max(1, os.cpus().length - 1); - + Config.Client.concurrentThumbnailGenerations = 1; switch (Config.Server.thumbnail.processingLibrary) { case ThumbnailProcessingLib.Jimp: this.ThumbnailFunction = ThumbnailRenderers.jimp; @@ -45,6 +44,7 @@ export class ThumbnailGeneratorMWs { if (Config.Server.enableThreading == true && Config.Server.thumbnail.processingLibrary == ThumbnailProcessingLib.Jimp) { + Config.Client.concurrentThumbnailGenerations = Math.max(1, os.cpus().length - 1); const Pool = require('threads').Pool; this.thPool = new Pool(Config.Client.concurrentThumbnailGenerations); this.thPool.run(this.ThumbnailFunction); diff --git a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html index bec8b9ce..e5d944eb 100644 --- a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html +++ b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html @@ -1,5 +1,5 @@
- + diff --git a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts index 2aae2461..006c4d49 100644 --- a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts +++ b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts @@ -101,6 +101,15 @@ export class GalleryPhotoComponent implements IRenderable, OnInit, OnDestroy { } */ public getDimension(): Dimension { + if (!this.imageRef) { + return { + top: 0, + left: 0, + width: 0, + height: 0 + }; + } + return { top: this.imageRef.nativeElement.offsetTop, left: this.imageRef.nativeElement.offsetLeft, diff --git a/package.json b/package.json index df1a89f2..e2326a33 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "ng2-cookies": "^1.0.12", "ng2-slim-loading-bar": "^4.0.0", "node-iptc": "^1.0.4", - "optimist": "^0.6.1", "reflect-metadata": "^0.1.10", "rxjs": "^5.4.1", "systemjs": "0.20.14", @@ -66,7 +65,6 @@ "@types/gm": "^1.17.31", "@types/jasmine": "^2.5.52", "@types/node": "^8.0.1", - "@types/optimist": "0.0.29", "@types/sharp": "^0.17.2", "@types/winston": "^2.3.3", "chai": "^4.0.2",