mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
fixing infobar keyword error
This commit is contained in:
parent
49b749d90b
commit
029dd68e5c
@ -33,7 +33,7 @@ export class DiskMangerWorker {
|
||||
return reject({file: fullPath, error: err});
|
||||
}
|
||||
const metadata: PhotoMetadata = <PhotoMetadata>{
|
||||
keywords: {},
|
||||
keywords: [],
|
||||
cameraData: {},
|
||||
positionData: null,
|
||||
size: {},
|
||||
@ -51,6 +51,7 @@ export class DiskMangerWorker {
|
||||
|
||||
try {
|
||||
const exif = exif_parser.create(data).parse();
|
||||
console.log(exif);
|
||||
metadata.cameraData = <CameraMetadata> {
|
||||
ISO: exif.tags.ISO,
|
||||
model: exif.tags.Model,
|
||||
@ -69,9 +70,20 @@ export class DiskMangerWorker {
|
||||
};
|
||||
}
|
||||
|
||||
if (exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate) {
|
||||
metadata.creationDate = exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate;
|
||||
}
|
||||
|
||||
|
||||
if (exif.imageSize) {
|
||||
metadata.size = <ImageSize> {width: exif.imageSize.width, height: exif.imageSize.height};
|
||||
} else if (exif.tags.RelatedImageWidth && exif.tags.RelatedImageHeight) {
|
||||
metadata.size = <ImageSize> {width: exif.tags.RelatedImageWidth, height: exif.tags.RelatedImageHeight};
|
||||
} else {
|
||||
metadata.size = <ImageSize> {width: 1, height: 1};
|
||||
}
|
||||
} catch (err) {
|
||||
Logger.info(LOG_TAG, "Error parsing exif", fullPath);
|
||||
Logger.debug(LOG_TAG, "Error parsing exif", fullPath, err);
|
||||
metadata.size = <ImageSize> {width: 1, height: 1};
|
||||
}
|
||||
|
||||
@ -83,13 +95,15 @@ export class DiskMangerWorker {
|
||||
metadata.positionData.state = iptcData.province_or_state;
|
||||
metadata.positionData.city = iptcData.city;
|
||||
}
|
||||
|
||||
metadata.keywords = <string[]> (iptcData.keywords || []);
|
||||
metadata.creationDate = <number> (iptcData.date_time ? iptcData.date_time.getTime() : 0);
|
||||
metadata.creationDate = <number> (iptcData.date_time ? iptcData.date_time.getTime() : metadata.creationDate);
|
||||
|
||||
} catch (err) {
|
||||
Logger.info(LOG_TAG, "Error parsing iptc data", fullPath, err);
|
||||
Logger.debug(LOG_TAG, "Error parsing iptc data", fullPath, err);
|
||||
}
|
||||
|
||||
metadata.creationDate = metadata.creationDate || 0;
|
||||
|
||||
return resolve(metadata);
|
||||
} catch (err) {
|
||||
return reject({file: fullPath, error: err});
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div #photoContainer class="photo-container" (mouseover)="hover()" (mouseout)="mouseOut()">
|
||||
<div #photoContainer class="photo-container" (mouseover)="mouseOver()" (mouseout)="mouseOut()">
|
||||
<img #img [src]="thumbnail.Src" *ngIf="thumbnail.Available">
|
||||
|
||||
<gallery-grid-photo-loading
|
||||
@ -24,7 +24,7 @@
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
<div class="photo-keywords">
|
||||
<div class="photo-keywords" *ngIf="gridPhoto.photo.metadata.keywords && gridPhoto.photo.metadata.keywords.length">
|
||||
<ng-template ngFor let-keyword [ngForOf]="gridPhoto.photo.metadata.keywords" let-last="last">
|
||||
<a *ngIf="searchEnabled"
|
||||
[routerLink]="['/search', keyword, {type: SearchTypes[SearchTypes.keyword]}]">#{{keyword}}</a>
|
||||
|
@ -86,14 +86,24 @@ export class GalleryPhotoComponent implements IRenderable, OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
|
||||
hover() {
|
||||
mouseOver() {
|
||||
this.infoBar.visible = true;
|
||||
if (this.animationTimer != null) {
|
||||
clearTimeout(this.animationTimer);
|
||||
}
|
||||
this.animationTimer = setTimeout(() => {
|
||||
this.infoBar.marginTop = -this.infoDiv.nativeElement.clientHeight;
|
||||
this.infoBar.background = "rgba(0,0,0,0.8)";
|
||||
|
||||
if (!this.infoDiv) {
|
||||
this.animationTimer = setTimeout(() => {
|
||||
if (!this.infoDiv) {
|
||||
this.infoBar.marginTop = -50;
|
||||
return;
|
||||
}
|
||||
this.infoBar.marginTop = -this.infoDiv.nativeElement.clientHeight;
|
||||
}, 10);
|
||||
return;
|
||||
}
|
||||
}, 1);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user