feat: add some better exif
All checks were successful
Deploy to SFTP Server / build (push) Successful in 10m58s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 10m58s
This commit is contained in:
parent
6f433e08ce
commit
e68f433f1e
@ -145,12 +145,21 @@
|
|||||||
console.log("Error loading", image);
|
console.log("Error loading", image);
|
||||||
});
|
});
|
||||||
|
|
||||||
let exif = null;
|
let exif = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let rawExif = image.getAttribute("data-exif");
|
const rawExif = image.getAttribute("data-exif");
|
||||||
exif = JSON.parse(rawExif);
|
const exifData = JSON.parse(rawExif);
|
||||||
console.log(exif);
|
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) {
|
} catch (error) {
|
||||||
// No biggie
|
// No biggie
|
||||||
}
|
}
|
||||||
@ -229,22 +238,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if images[currentIndex].exif}
|
{#if images[currentIndex].exif}
|
||||||
{@const exif = images[currentIndex].exif}
|
{@const exif = images[currentIndex].exif}
|
||||||
<div class="exif" on:click={() => console.log(exif)}>
|
<div class="exif">
|
||||||
{#if "FocalLength" in exif}
|
{exif.join(" | ")}
|
||||||
{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>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
BIN
src/content/photos/peaks-of-the-balkans/images/MAX_9861.jpg
(Stored with Git LFS)
BIN
src/content/photos/peaks-of-the-balkans/images/MAX_9861.jpg
(Stored with Git LFS)
Binary file not shown.
@ -34,6 +34,7 @@ export async function generateThumbHash(image: { width: number, height: number }
|
|||||||
const allowedExif = [
|
const allowedExif = [
|
||||||
"ApertureValue",
|
"ApertureValue",
|
||||||
"DateTimeOriginal",
|
"DateTimeOriginal",
|
||||||
|
"ShutterSpeedValue",
|
||||||
"ExposureTime",
|
"ExposureTime",
|
||||||
"ApertureValue",
|
"ApertureValue",
|
||||||
"FNumber",
|
"FNumber",
|
||||||
@ -42,6 +43,8 @@ const allowedExif = [
|
|||||||
"GPSLongitude",
|
"GPSLongitude",
|
||||||
"GPSAltitude",
|
"GPSAltitude",
|
||||||
"IsoSpeedRatings",
|
"IsoSpeedRatings",
|
||||||
|
"Make",
|
||||||
|
"Model",
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function getExifData(image: ImageMetadata) {
|
export async function getExifData(image: ImageMetadata) {
|
||||||
@ -56,7 +59,7 @@ export async function getExifData(image: ImageMetadata) {
|
|||||||
for (const key of allowedExif) {
|
for (const key of allowedExif) {
|
||||||
if (!tags[key]) continue;
|
if (!tags[key]) continue;
|
||||||
hasExif = true;
|
hasExif = true;
|
||||||
out[key] = tags[key].description;
|
out[key] = tags[key]?.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasExif ? out : undefined;
|
return hasExif ? out : undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user