MCPcopy Index your code
hub / github.com/coollabsio/next-image-transformation

github.com/coollabsio/next-image-transformation @0.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.0.3 ↗ · + Follow
2 symbols 4 edges 1 files 0 documented · 0% updated 18mo ago0.0.3 · 2024-03-14★ 6297 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Next.js Image Transformation

It is a drop-in replacement for resizing images with Next.js used in \ component from next/image: https://nextjs.org/docs/pages/api-reference/components/image

Try it out

  • Change the width query parameter to see the image resize on the fly.
  • Add the height query parameter to see the image crop on the fly.
  • Add the quality query parameter to see the image quality change on the fly.

https://image.coollabs.io/image/https://cdn.coollabs.io/assets/coolify/og-image-v4.png?width=50

Includes

  1. Next Image Transformation API.
  2. A simple API written in Bun that transforms the incoming request to Imgproxy format and forwards it to the Imgproxy service.
  3. Imgproxy service.
  4. A powerful and fast image processing service that can resize, crop, and transform images on the fly.

How to deploy with Coolify

  1. Login to your Coolify instance or the cloud.
  2. Create a new service and select the Next.js Image Transformation template.
  3. Optional: Set the ALLOWED_REMOTE_DOMAINS environment variable to the domain of your images (e.g. example.com,coolify.io). By default, it is set to * which allows any domain.
  4. Set the your <domain> on the Next Image Transformation service.
  5. Deploy your service.

How to use in Next.js

  1. In next.config.js add the following:
module.exports = {
  images: {
    loader: 'custom',
    loaderFile: './loader.js',
  },
}
  1. Create a file called loader.js in the root of your project and add the following:
'use client'

export default function myImageLoader({ src, width, quality }) {
  return `https://<domain>/image/${src}?w=${width}&q=${quality || 75}`
}

Replace <domain> with the URL of what you set on the Next Image Transformation API.

Currently supported transformations

  • width
  • height
  • quality

Core symbols most depended-on inside this repo

Shape

Function 2

Languages

TypeScript100%

Modules by API surface

index.js2 symbols

For agents

$ claude mcp add next-image-transformation \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page