1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

null image error fix

This commit is contained in:
Braun Patrik 2017-06-22 22:07:47 +02:00
parent c09052a2a5
commit 16f1afdf10
4 changed files with 12 additions and 5 deletions

View File

@ -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);

View File

@ -1,5 +1,5 @@
<div #photoContainer class="photo-container" (mouseover)="hover()" (mouseout)="mouseOut()">
<img #img [src]="thumbnail.Src" [hidden]="!thumbnail.Available">
<img #img [src]="thumbnail.Src" *ngIf="thumbnail.Available">
<gallery-grid-photo-loading [animate]="thumbnail.loading" *ngIf="!thumbnail.Available">
</gallery-grid-photo-loading>

View File

@ -101,6 +101,15 @@ export class GalleryPhotoComponent implements IRenderable, OnInit, OnDestroy {
}
*/
public getDimension(): Dimension {
if (!this.imageRef) {
return <Dimension>{
top: 0,
left: 0,
width: 0,
height: 0
};
}
return <Dimension>{
top: this.imageRef.nativeElement.offsetTop,
left: this.imageRef.nativeElement.offsetLeft,

View File

@ -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",