@@ -13,9 +24,9 @@ export function Gallery({ images, alt }: { images: string[]; alt: string }) {
}
return (
-
+
+
{images.length > 1 && (
{images.map((src, i) => (
@@ -32,6 +43,18 @@ export function Gallery({ images, alt }: { images: string[]; alt: string }) {
))}
)}
+
);
}
diff --git a/src/lib/upload.ts b/src/lib/upload.ts
index 1df1631..8fb92af 100644
--- a/src/lib/upload.ts
+++ b/src/lib/upload.ts
@@ -6,6 +6,9 @@ import { getCurrentUser, can } from "./auth";
const EXT: Record
= { "image/jpeg": ".jpg", "image/png": ".png", "image/webp": ".webp", "image/gif": ".gif", "image/avif": ".avif" };
+// Bilder werden unverändert in Originalgröße gespeichert, nicht verkleinert oder neu komprimiert.
+const MAX_MB = 25;
+
export async function uploadImages(fd: FormData): Promise<{ urls: string[]; error?: string }> {
const user = await getCurrentUser();
if (!can(user, "products.edit") && !can(user, "categories.edit") && !can(user, "appearance.edit")) return { urls: [], error: "Dafür fehlt dir das Recht." };
@@ -15,8 +18,8 @@ export async function uploadImages(fd: FormData): Promise<{ urls: string[]; erro
for (const file of fd.getAll("files")) {
if (!(file instanceof File) || file.size === 0) continue;
const ext = EXT[file.type];
- if (!ext) return { urls, error: `${file.name}: Bitte JPG, PNG, WebP oder GIF hochladen.` };
- if (file.size > 8 * 1024 * 1024) return { urls, error: `${file.name} ist größer als 8 MB.` };
+ if (!ext) return { urls, error: `${file.name}: Bitte JPG, PNG, WebP, AVIF oder GIF hochladen. iPhone-Fotos (HEIC) wandelt das iPhone beim Hochladen automatisch um.` };
+ if (file.size > MAX_MB * 1024 * 1024) return { urls, error: `${file.name} ist größer als ${MAX_MB} MB.` };
const name = `${Date.now().toString(36)}-${randomBytes(6).toString("hex")}${ext}`;
await writeFile(path.join(dir, name), Buffer.from(await file.arrayBuffer()));
urls.push(`/uploads/${name}`);
diff --git a/src/styles/bundle.css b/src/styles/bundle.css
index cc7bd07..bc8fe64 100644
--- a/src/styles/bundle.css
+++ b/src/styles/bundle.css
@@ -137,7 +137,7 @@ button { font: inherit; color: inherit; }
.sm-card { position: relative; display: flex; flex-direction: column; gap: var(--space-3); color: var(--ink); text-decoration: none; }
.sm-card__media { position: relative; overflow: hidden; border-radius: var(--radius-md); background: var(--surface-sunken); aspect-ratio: var(--product-image-ratio); }
.sm-card__media > img, .sm-card__media > .sm-ph { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
-.sm-card:hover .sm-card__media > img, .sm-card:hover .sm-card__media > .sm-ph { transform: scale(1.03); }
+.sm-card:hover .sm-card__media > .sm-ph { transform: scale(1.03); }
.sm-card__badges { position: absolute; top: var(--space-3); left: var(--space-3); display: flex; gap: var(--space-1); z-index: 1; }
.sm-card__wish { position: absolute; top: var(--space-2); right: var(--space-2); z-index: 1; width: var(--touch-target); height: var(--touch-target); display: grid; place-content: center; border: 0; border-radius: var(--radius-pill); background: var(--surface-raised); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm); }
.sm-card__wish:hover { color: var(--gold-deep); }
diff --git a/src/styles/shop.css b/src/styles/shop.css
index e86772e..33abf76 100644
--- a/src/styles/shop.css
+++ b/src/styles/shop.css
@@ -113,3 +113,19 @@ h1, h2, h3 { margin: 0; }
.sm-form-row > .sm-field > .sm-field__label { align-self: end; }
}
}
+
+/* Produktfoto in voller Größe */
+button.sm-pdp__main { display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; }
+.sm-pdp__main img { width: 100%; height: 100%; object-fit: cover; }
+.sm-lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(12, 11, 9, 0.94); color: #fff; }
+.sm-lightbox::backdrop { background: rgba(12, 11, 9, 0.94); }
+.sm-lightbox__stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; }
+.sm-pdp__gallery .sm-lightbox__stage img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
+.sm-lightbox.is-zoomed .sm-lightbox__stage { display: block; }
+.sm-pdp__gallery .sm-lightbox.is-zoomed .sm-lightbox__stage img { max-width: none; max-height: none; cursor: zoom-out; }
+.sm-lightbox__close, .sm-lightbox__nav { position: fixed; z-index: 1; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(12, 11, 9, 0.6); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
+.sm-lightbox__close { top: 16px; right: 16px; }
+.sm-lightbox__nav { top: 50%; transform: translateY(-50%); }
+.sm-lightbox__nav--prev { left: 16px; }
+.sm-lightbox__nav--next { right: 16px; }
+.sm-lightbox__close:hover, .sm-lightbox__nav:hover { background: rgba(12, 11, 9, 0.85); }