mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This PR adds a new example that shows a more complex use case where you don't want browser to know about the upstream image server so instead you can proxy through a serverless function. Some use cases might be checking for an IP address, user agent, etc.
8 lines
229 B
TypeScript
8 lines
229 B
TypeScript
import Image, { ImageProps } from "next/image";
|
|
|
|
export function SecureImage(props: ImageProps) {
|
|
const src =
|
|
typeof props.src === "string" ? `/image-api${props.src}` : props.src;
|
|
return <Image {...props} src={src} />;
|
|
}
|