Skip to content

Instantly share code, notes, and snippets.

@DanielPantle
DanielPantle / StrapiImage.tsx
Last active January 17, 2024 13:08
Next.js ImageLoader for Strapi
// custom Next.js component for displaying Strapi images with a custom loader
// NEXT_PUBLIC_BACKEND_URL_IMAGES needs to be set in the .env file, e.g.: NEXT_PUBLIC_BACKEND_URL_IMAGES=http://localhost:1337
// For placeholders to work, install strapi-plugin-placeholder
'use client';
import { default as NextImage, ImageLoader, ImageProps } from 'next/image';
import _strapiBreakpoints from '/src/data/preBuild/strapiBreakpoints.json';
export interface IStrapiImage {