diff --git a/static/index.html b/static/index.html index ad4251e..ac76173 100644 --- a/static/index.html +++ b/static/index.html @@ -1732,15 +1732,15 @@ } })(); - function handlePickedPhoto(file) { + async function handlePickedPhoto(file) { pickedPhotoFile = file; const reader = new FileReader(); - reader.onload = function(e) { + reader.onload = async function(e) { document.getElementById('pickedPhotoPreview').src = e.target.result; document.getElementById('photoPreviewCard').style.display = 'block'; // Extract EXIF / file metadata - extractExifData(file); + await extractExifData(file); // Auto-extract GPS from the picked photo tryExtractGpsFromPicked(); @@ -1751,13 +1751,44 @@ reader.readAsDataURL(file); } - function extractExifData(file) { + async function extractExifData(file) { const exifDiv = document.getElementById('pickedExifData'); const rows = []; - rows.push({ label: 'File name', value: file.name }); - rows.push({ label: 'File size', value: formatFileSize(file.size) }); - rows.push({ label: 'Type', value: file.type || 'unknown' }); - rows.push({ label: 'Last modified', value: formatDate(new Date(file.lastModified).toISOString()) }); + rows.push({ label: '📄 File name', value: file.name }); + rows.push({ label: '📦 File size', value: formatFileSize(file.size) }); + rows.push({ label: '🏷️ Type', value: file.type || 'unknown' }); + rows.push({ label: '🕐 Modified', value: formatDate(new Date(file.lastModified).toISOString()) }); + + // Try to read actual EXIF tags from the file + try { + const exifData = await exifr.parse(file); + if (exifData) { + if (exifData.Make || exifData.Model) { + rows.push({ label: '📷 Camera', value: [exifData.Make, exifData.Model].filter(Boolean).join(' ') }); + } + if (exifData.DateTimeOriginal) { + const d = new Date(exifData.DateTimeOriginal); + rows.push({ label: '📅 Date taken', value: d.toLocaleString() }); + } + if (exifData.ISO) { + rows.push({ label: '🎯 ISO', value: String(exifData.ISO) }); + } + if (exifData.FNumber) { + rows.push({ label: '🔆 Aperture', value: 'f/' + exifData.FNumber }); + } + if (exifData.ExposureTime) { + rows.push({ label: '⏱️ Shutter', value: exifData.ExposureTime + 's' }); + } + if (exifData.FocalLength) { + rows.push({ label: '🔭 Focal', value: exifData.FocalLength + 'mm' }); + } + if (exifData.GPSLatitude && exifData.GPSLongitude) { + const lat = exifData.latitude || exifData.GPSLatitude; + const lng = exifData.longitude || exifData.GPSLongitude; + rows.push({ label: '📍 GPS', value: typeof lat === 'number' ? `${lat.toFixed(6)}, ${lng.toFixed(6)}` : `${exifData.GPSLatitude.join(' ')} ${exifData.GPSLatitudeRef}, ${exifData.GPSLongitude.join(' ')} ${exifData.GPSLongitudeRef}` }); + } + } + } catch (_) { /* EXIF display is best-effort */ } exifDiv.innerHTML = rows.map(r => `
${esc(r.label)}${esc(r.value)}
` diff --git a/uploads/photos/0ecfcc9ddda541f8887d621f9219d010.jpg b/uploads/photos/0ecfcc9ddda541f8887d621f9219d010.jpg new file mode 100644 index 0000000..1b14abb Binary files /dev/null and b/uploads/photos/0ecfcc9ddda541f8887d621f9219d010.jpg differ diff --git a/uploads/photos/44caeacf8d0b41669e1cc6500f216203.jpg b/uploads/photos/44caeacf8d0b41669e1cc6500f216203.jpg new file mode 100644 index 0000000..c18b408 Binary files /dev/null and b/uploads/photos/44caeacf8d0b41669e1cc6500f216203.jpg differ diff --git a/uploads/photos/557ba8d1223340bf89a0b0b495b0a75e.jpg b/uploads/photos/557ba8d1223340bf89a0b0b495b0a75e.jpg new file mode 100644 index 0000000..73d23c7 Binary files /dev/null and b/uploads/photos/557ba8d1223340bf89a0b0b495b0a75e.jpg differ diff --git a/uploads/photos/59dd8174afe644f0804e3a36e45f94fa.jpg b/uploads/photos/59dd8174afe644f0804e3a36e45f94fa.jpg new file mode 100644 index 0000000..73d23c7 Binary files /dev/null and b/uploads/photos/59dd8174afe644f0804e3a36e45f94fa.jpg differ diff --git a/uploads/photos/74c1bfba3d4f492b8045d61da8a3db06.jpg b/uploads/photos/74c1bfba3d4f492b8045d61da8a3db06.jpg new file mode 100644 index 0000000..c18b408 Binary files /dev/null and b/uploads/photos/74c1bfba3d4f492b8045d61da8a3db06.jpg differ diff --git a/uploads/photos/a8c7e55327ec498dadecf408afa224f4.jpg b/uploads/photos/a8c7e55327ec498dadecf408afa224f4.jpg new file mode 100644 index 0000000..79a302b Binary files /dev/null and b/uploads/photos/a8c7e55327ec498dadecf408afa224f4.jpg differ diff --git a/uploads/photos/f3c9b6b3522a4980858df80c70bd5a1d.jpg b/uploads/photos/f3c9b6b3522a4980858df80c70bd5a1d.jpg new file mode 100644 index 0000000..e940826 Binary files /dev/null and b/uploads/photos/f3c9b6b3522a4980858df80c70bd5a1d.jpg differ