From eb52ca1a7583585a7e96b6d26e17d74ee23fecbe Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Wed, 30 Oct 2024 13:25:39 +0100 Subject: [PATCH] WIP --- components/Image.tsx | 6 ++++++ next.config.js | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/components/Image.tsx b/components/Image.tsx index 419259fc3..a5ea6e16a 100644 --- a/components/Image.tsx +++ b/components/Image.tsx @@ -8,7 +8,13 @@ import type { CSSProperties } from "react" import type { ImageProps } from "@/types/components/image" function imageLoader({ quality, src, width }: ImageLoaderProps) { + const isAbsoluteUrl = src.startsWith("https://") || src.startsWith("http://") const hasQS = src.indexOf("?") !== -1 + + if (isAbsoluteUrl) { + return `https://image-scandic-hotels.netlify.app/.netlify/images?url=${src}&w=${width}${quality ? "&q=" + quality : ""}` + } + return `${src}${hasQS ? "&" : "?"}w=${width}${quality ? "&q=" + quality : ""}` } diff --git a/next.config.js b/next.config.js index 2e8553f1c..d8e14a2f8 100644 --- a/next.config.js +++ b/next.config.js @@ -43,6 +43,10 @@ const nextConfig = { protocol: "https", hostname: "*.scandichotels.com", }, + { + protocol: "https", + hostname: "image-scandic-hotels.netlify.app", + }, ], },