diff --git a/app/api/image/[id]/route.ts b/app/api/image/[id]/route.ts index 0aa861e..5a1cd5f 100644 --- a/app/api/image/[id]/route.ts +++ b/app/api/image/[id]/route.ts @@ -67,10 +67,13 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{ console.log(`[Image API] ✅ Serving ${assetId} (${size}) - Type: ${result.contentType}`); const headers: Record = { - 'Content-Type': result.contentType, + 'Content-Type': result.contentType.includes('application/octet-stream') + ? 'image/jpeg' + : result.contentType, // Images are immutable once uploaded to Immich — cache aggressively 'Cache-Control': 'public, max-age=31536000, immutable', 'X-RateLimit-Remaining': String(remaining), + 'Access-Control-Allow-Origin': '*', // Allow cross-origin for lightbox }; if (result.contentLength) { diff --git a/components/Lightbox.tsx b/components/Lightbox.tsx index c7315c6..c72ff26 100644 --- a/components/Lightbox.tsx +++ b/components/Lightbox.tsx @@ -175,6 +175,7 @@ export function Lightbox({ assets, currentIndex, onClose, onNext, onPrev }: Ligh src={current.previewUrl} alt="" draggable={false} + crossOrigin="anonymous" onLoad={() => setImageLoaded(true)} />