-
![]()
+ [src]="thumbnailPath()"/>
![]()
+ [src]="gridPhoto.getPhotoPath()"
+ (load)="onImageLoad()"
+ (error)="onImageError()"/>
diff --git a/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts b/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts
index d467484..f50cb18 100644
--- a/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts
+++ b/frontend/app/gallery/lightbox/photo/photo.lightbox.gallery.component.ts
@@ -15,11 +15,14 @@ export class GalleryLightboxPhotoComponent implements OnChanges {
public imageSize = {width: "auto", height: "100"};
@ViewChild('imgContainer') nativeElement:ElementRef;
+ imageLoaded:boolean = false;
constructor() {
}
ngOnChanges() {
+
+ this.imageLoaded = false;
this.setImageSize();
}
@@ -37,5 +40,29 @@ export class GalleryLightboxPhotoComponent implements OnChanges {
}
}
+
+ onImageLoad() {
+ this.imageLoaded = true;
+ }
+
+ onImageError() {
+ //TODO:handle error
+ console.error("cant load image");
+ }
+
+ public showThumbnail():boolean {
+ return this.gridPhoto && !this.imageLoaded &&
+ (this.gridPhoto.isThumbnailAvailable() || this.gridPhoto.isReplacementThumbnailAvailable());
+ }
+
+ public thumbnailPath():string {
+ if (this.gridPhoto.isThumbnailAvailable() === true)
+ return this.gridPhoto.getThumbnailPath();
+
+ if (this.gridPhoto.isReplacementThumbnailAvailable() === true)
+ return this.gridPhoto.getReplacementThumbnailPath();
+ return null
+ }
+
}