feat: add exif data to image tags
Some checks failed
Deploy to SFTP Server / build (push) Failing after 1m34s

This commit is contained in:
2024-06-21 16:15:48 +02:00
parent 08c852a9e8
commit e5726437ed
5 changed files with 62 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
---
import type { ImageMetadata } from "astro";
import { Picture as AstroImage } from "astro:assets";
import { generateThumbHash } from "@helpers/image";
import { generateThumbHash, getExifData } from "@helpers/image";
interface Props {
src: ImageMetadata;
alt: string;
@@ -24,6 +24,8 @@ const {
let thumbhash = hash ? await generateThumbHash(image) : "";
let exif = await getExifData(image);
const sizes = [
{
width: 240,
@@ -47,6 +49,7 @@ const sizes = [
src={image}
alt={alt}
data-thumbhash={thumbhash}
data-exif={JSON.stringify(exif)}
pictureAttributes={{
class: `${hash ? "block h-full relative" : ""} ${loader ? "thumb" : ""} ${pictureClass}`,
}}