feat: add some better exif
All checks were successful
Deploy to SFTP Server / build (push) Successful in 10m58s

This commit is contained in:
2024-06-21 17:03:52 +02:00
parent 6f433e08ce
commit e68f433f1e
3 changed files with 21 additions and 23 deletions

View File

@ -145,12 +145,21 @@
console.log("Error loading", image);
});
let exif = null;
let exif = [];
try {
let rawExif = image.getAttribute("data-exif");
exif = JSON.parse(rawExif);
console.log(exif);
const rawExif = image.getAttribute("data-exif");
const exifData = JSON.parse(rawExif);
if (exifData) {
exif = [
"Model" in exifData ? exifData.Model : "",
"FocalLength" in exifData
? exifData.FocalLength.replace(" mm", "mm")
: "",
"FNumber" in exifData ? exifData.FNumber : "",
"ExposureTime" in exifData ? exifData.ExposureTime : "",
];
}
} catch (error) {
// No biggie
}
@ -229,22 +238,8 @@
</div>
{#if images[currentIndex].exif}
{@const exif = images[currentIndex].exif}
<div class="exif" on:click={() => console.log(exif)}>
{#if "FocalLength" in exif}
{exif.FocalLength} |
{/if}
{#if "FNumber" in exif}
<i>f</i>{exif.FNumber} |
{/if}
{#if "ExposureTime" in exif}
{exif.ExposureTime.replace(" s", "s")} |
{/if}
{#if "Date" in exif}
{exif.Date}
{/if}
<div class="exif">
{exif.join(" | ")}
</div>
{/if}
{/if}