From 66465fdc9893fa4c3f0c1f5b8279a51c33a1e407 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 10 Oct 2024 23:02:12 +0200 Subject: [PATCH] Fix: attempt to workaround for #2202 --- src/Logic/ImageProviders/Panoramax.ts | 24 ++++++++++++++++++------ src/Models/ThemeViewState.ts | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Logic/ImageProviders/Panoramax.ts b/src/Logic/ImageProviders/Panoramax.ts index c05da71b3..60d558a26 100644 --- a/src/Logic/ImageProviders/Panoramax.ts +++ b/src/Logic/ImageProviders/Panoramax.ts @@ -23,11 +23,14 @@ export default class PanoramaxImageProvider extends ImageProvider { private static knownMeta: Record = {} - public SourceIcon(img?: { id: string, url: string, host?: string }, location?: { lon: number; lat: number; }): BaseUIElement { + public SourceIcon(img?: { id: string, url: string, host?: string }, location?: { + lon: number; + lat: number; + }): BaseUIElement { const p = new Panoramax(img.host) return new Link(new SvelteUIElement(Panoramax_bw), p.createViewLink({ imageId: img?.id, - location + location, }), true) } @@ -173,15 +176,24 @@ export class PanoramaxUploader implements ImageUploader { absoluteUrl: string }> { - const tags = await ExifReader.load(blob) - const hasDate = tags.DateTime !== undefined - const hasGPS = tags.GPSLatitude !== undefined && tags.GPSLongitude !== undefined + let tags: ExifReader.Tags = undefined + let hasDate = false + let hasGPS = false + try { + const tags = await ExifReader.load(blob) + hasDate = tags?.DateTime !== undefined + hasGPS = tags?.GPSLatitude !== undefined && tags?.GPSLongitude !== undefined + } catch (e) { + console.error("Could not read EXIF-tags") + } - const [lon, lat] = currentGps + let [lon, lat] = currentGps const p = this._panoramax const defaultSequence = (await p.mySequences())[0] const img = await p.addImage(blob, defaultSequence, { + // It might seem odd that we set 'undefined' here - keep in mind that, by default, panoramax will use the EXIF-data + // We only pass variables as fallback! lat: !hasGPS ? lat : undefined, lon: !hasGPS ? lon : undefined, datetime: !hasDate ? new Date().toISOString() : undefined, diff --git a/src/Models/ThemeViewState.ts b/src/Models/ThemeViewState.ts index 596060f12..f83053613 100644 --- a/src/Models/ThemeViewState.ts +++ b/src/Models/ThemeViewState.ts @@ -1036,7 +1036,7 @@ export default class ThemeViewState implements SpecialVisualizationState { } if (extramessage) { - message += "(" + extramessage + ")" + message += " (" + extramessage + ")" } const stacktrace: string = new Error().stack