diff --git a/static/index.html b/static/index.html
index 9267423..97322b2 100644
--- a/static/index.html
+++ b/static/index.html
@@ -1794,21 +1794,18 @@
showToast('GPS data will be extracted server-side — check EXIF info below for file details');
}
- function createAssetFromPicked() {
+ async function createAssetFromPicked() {
if (!pickedPhotoFile) return;
- // Switch to Manual mode and pre-load the photo
+ // Switch to Manual mode and pass the original file (preserves EXIF)
setAddAssetMode('manual');
+
+ // Pass the original File directly — preserves EXIF for server re-embed
+ manualPhotoFile = pickedPhotoFile;
+ manualPhotoBlob = pickedPhotoFile; // Use original file (preserves EXIF)
+
+ // Show the photo in the manual preview using FileReader
const reader = new FileReader();
reader.onload = function(e) {
- // Convert data URL to blob for manualPhotoBlob
- const arr = e.target.result.split(',');
- const mime = arr[0].match(/:(.*?);/)[1];
- const bstr = atob(arr[1]);
- let n = bstr.length;
- const u8arr = new Uint8Array(n);
- while (n--) { u8arr[n] = bstr.charCodeAt(n); }
- manualPhotoBlob = new Blob([u8arr], { type: mime });
- // Show the photo in the manual preview
const img = document.getElementById('manPhotoPreview');
img.src = e.target.result;
img.style.display = 'block';
@@ -1818,6 +1815,21 @@
if (retake) retake.style.display = 'block';
};
reader.readAsDataURL(pickedPhotoFile);
+
+ // Try EXIF GPS from the original file
+ manualPhotoGps = await extractGpsFromPhoto(pickedPhotoFile);
+ if (manualPhotoGps) {
+ const coords = manualPhotoGps.lat.toFixed(6) + ', ' + manualPhotoGps.lng.toFixed(6);
+ const parkingEl = document.getElementById('manParkingLocation');
+ if (parkingEl && !parkingEl.value.trim()) {
+ parkingEl.value = coords;
+ }
+ const mapLinkEl = document.getElementById('manMapLink');
+ if (mapLinkEl && !mapLinkEl.value.trim()) {
+ mapLinkEl.value = `https://www.openstreetmap.org/?mlat=${manualPhotoGps.lat}&mlon=${manualPhotoGps.lng}&zoom=17`;
+ }
+ }
+
showToast('Photo loaded into Manual mode');
}