1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-05-17 22:22:48 +02:00

fixing exif orientation bug on map

This commit is contained in:
Patrik J. Braun 2018-11-02 11:44:13 +01:00
parent 64dc2ef2d8
commit 205f98e654
3 changed files with 7 additions and 5 deletions

View File

@ -80,7 +80,7 @@ export class PhotoMetadataEntity implements PhotoMetadata {
@Column(type => PositionMetaDataEntity) @Column(type => PositionMetaDataEntity)
positionData: PositionMetaDataEntity; positionData: PositionMetaDataEntity;
@Column('tinyint', {default: 1}) @Column('tinyint', {default: OrientationTypes.TOP_LEFT})
orientation: OrientationTypes; orientation: OrientationTypes;
@Column(type => ImageSizeEntity) @Column(type => ImageSizeEntity)

View File

@ -93,7 +93,7 @@ export class DiskMangerWorker {
cameraData: {}, cameraData: {},
positionData: null, positionData: null,
size: {}, size: {},
orientation: OrientationTypes.TOP_RIGHT, orientation: OrientationTypes.TOP_LEFT,
creationDate: 0, creationDate: 0,
fileSize: 0 fileSize: 0
}; };
@ -133,6 +133,7 @@ export class DiskMangerWorker {
metadata.orientation = exif.tags.Orientation; metadata.orientation = exif.tags.Orientation;
} }
if (exif.imageSize) { if (exif.imageSize) {
metadata.size = <ImageSize> {width: exif.imageSize.width, height: exif.imageSize.height}; metadata.size = <ImageSize> {width: exif.imageSize.width, height: exif.imageSize.height};
} else if (exif.tags.RelatedImageWidth && exif.tags.RelatedImageHeight) { } else if (exif.tags.RelatedImageWidth && exif.tags.RelatedImageHeight) {

View File

@ -108,10 +108,11 @@ export class GalleryMapLightboxComponent implements OnChanges, AfterViewInit {
}).map(p => { }).map(p => {
let width = 500; let width = 500;
let height = 500; let height = 500;
if (p.metadata.size.width > p.metadata.size.height) { const rotatedSize = PhotoDTO.getRotatedSize(p);
height = width * (p.metadata.size.height / p.metadata.size.width); if (rotatedSize.width > rotatedSize.height) {
height = width * (rotatedSize.height / rotatedSize.width);
} else { } else {
width = height * (p.metadata.size.width / p.metadata.size.height); width = height * (rotatedSize.width / rotatedSize.height);
} }
const iconTh = this.thumbnailService.getIcon(new IconPhoto(p)); const iconTh = this.thumbnailService.getIcon(new IconPhoto(p));
iconTh.Visible = true; iconTh.Visible = true;