diff --git a/src/common/entities/MediaDTO.ts b/src/common/entities/MediaDTO.ts index 9c009e22..b00030cc 100644 --- a/src/common/entities/MediaDTO.ts +++ b/src/common/entities/MediaDTO.ts @@ -71,6 +71,6 @@ export const MediaDTOUtils = { }, calcAspectRatio: (photo: MediaDTO): number => { - return photo.metadata.size.width / photo.metadata.size.height; + return (photo.metadata.size.width / photo.metadata.size.height) || 1; // NaN should be treated as square photo }, }; diff --git a/src/frontend/app/ui/gallery/grid/GridRowBuilder.ts b/src/frontend/app/ui/gallery/grid/GridRowBuilder.ts index 0659b3fc..d8610a69 100644 --- a/src/frontend/app/ui/gallery/grid/GridRowBuilder.ts +++ b/src/frontend/app/ui/gallery/grid/GridRowBuilder.ts @@ -57,7 +57,7 @@ export class GridRowBuilder { let width = 0; for (const item of this.photoRow) { const size = item.metadata.size; - width += size.width / size.height; // summing up aspect ratios + width += (size.width / size.height) || 1; // summing up aspect ratios, NaN should be treated as square photo } const height = (this.containerWidth - diff --git a/src/frontend/app/ui/gallery/grid/grid.gallery.component.html b/src/frontend/app/ui/gallery/grid/grid.gallery.component.html index da8e4c63..26075b8a 100644 --- a/src/frontend/app/ui/gallery/grid/grid.gallery.component.html +++ b/src/frontend/app/ui/gallery/grid/grid.gallery.component.html @@ -5,8 +5,7 @@ [gridMedia]="gridPhoto" [style.width.px]="gridPhoto.renderWidth" [style.height.px]="gridPhoto.renderHeight" - [style.marginLeft.px]="IMAGE_MARGIN" - [style.marginRight.px]="IMAGE_MARGIN"> - + [style.margin-left.px]="IMAGE_MARGIN" + [style.margin-right.px]="IMAGE_MARGIN">