Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

netlify-image-cdn

БесплатноБез исполняемых скриптовНе проверен

Transform, resize, crop, and convert images on demand through Netlify Image CDN at the /.netlify/images endpoint. Use this skill whenever someone asks to…

netlifyот netlify★ 58 звёзд на GitHub

Об этом скилле

Netlify Image CDN

Use this / avoid this

// USE: build the URL on the site's own domain; url is required, the rest optional
const src = `/.netlify/images?url=${encodeURIComponent(remoteOrPath)}&w=400&h=300&fit=cover&fm=webp&q=75`;
# USE: single-quoted literal regex in netlify.toml
[images]
  remote_images = ['https://my-images\.com/.*']

Avoid:

  • _headers / headers rules targeting a path that rewrites to /.netlify/images (including /_next/image). They are silently ignored. Use an edge function instead.
  • headers() in next.config.js for next/image. It is ignored for the same reason.
  • fit=cover with only w or only h. Cover requires both.
  • Hand-rolling /.netlify/images URLs in Angular, Astro, Gatsby, Next.js, or Nuxt. Use the framework's image component, which already uses Image CDN (see Frameworks).

Endpoint

/.netlify/images?url=<source>[&w=<int>][&h=<int>][&fit=contain|cover|fill][&position=top|bottom|left|right|center][&fm=avif|jpg|png|webp|gif|blurhash][&q=1-100]
Param Values Default Notes
url relative (/owl.jpeg) or absolute remote URL required Remote URLs must match remote_images
w, h integer px — Applied according to fit
fit contain / cover / fill contain Same semantics as CSS object-fit
position top / bottom / left / right / center center The part of the image retained when fit=cover
fm avif jpg png webp gif blurhash negotiated webp and gif may be animated
q integer 1–100 75 Lossy quality for avif, jpg, gif, webp

Format negotiation when fm is omitted (from the Accept header): webp if accepted, else avif, else the original format. A url-only request keeps the image's dimensions but still converts the format.

Response codes:

  • 200: new transformation, with the correct content-type (for example image/png for fm=png).
  • 304: previously transformed image.
  • 404: any invalid parameter value. Check the parameters before suspecting the source.

fit behavior (400×310 source)

fit Aspect ratio kept Crops Exact dims returned Example
contain yes no no w=600&h=600 → 600×465. Upscaling is allowed. One dimension alone derives the other.
cover yes (scales, then crops) yes yes w=150&h=150 → resized to height 150, then left/right cropped
fill no (stretches) no yes w=300&h=100 → squished vertically

Examples

S=https://mysitename.netlify.app
curl -vs "$S/.netlify/images?url=/owl.jpeg"                                   # format negotiation only
curl -vs "$S/.netlify/images?url=/owl.jpeg&w=50"                              # resize width
curl -vs "$S/.netlify/images?url=/owl.jpeg&fit=cover&w=50&h=50"               # square crop
curl -vs "$S/.netlify/images?url=/owl.jpeg&fit=cover&w=50&h=50&position=left" # keep left side
curl -vs "$S/.netlify/images?url=/owl.jpeg&fm=png"                            # -> content-type: image/png
curl -vs "$S/.netlify/images?url=/owl.jpeg&fm=avif&q=50"                      # avif, medium quality
curl -vs "$S/.netlify/images?url=https%3A%2F%2Fmy-images.com%2Fowl.jpeg"      # remote (allowlisted)

Interactive parameter playground: https://image-cdn-playground.netlify.app/

Remote sources

[images]
  remote_images = [
    'https://my-images\.com/.*',
    'https://animals\.more-images\.com/[bcr]at/.*',
  ]
  • remote_images is an array of regexes. Anchor patterns to specific subdomains or directories.
  • Relative sources need no config.
  • Remote sources must be publicly reachable.
  • Footgun: Authorization, Cookie, and other credential-bearing headers are not forwarded to remote origins. Private buckets fail. Use self-authorizing URLs, such as S3 presigned URLs, and make sure the patterns match them.

  • Netlify cache duration for remote sources comes from the remote origin's headers. The first one present wins: Netlify-CDN-Cache-Control → CDN-Cache-Control → Cache-Control. You cannot set site headers on remote sources.

Reusable presets (rewrites)

_redirects:

/transform-small/* /.netlify/images?url=/:splat&w=50&h=50 200

netlify.toml:

redirects
  from = "/transform-small/*"
  to = "/.netlify/images?url=/:splat&w=50&h=50"
  status = 200

Request /transform-small/owl.jpeg. Avoid cross-site redirects for transformations, because they hurt performance. Redirect docs: https://docs.netlify.com/manage/routing/redirects/overview

Headers and caching

Goal How
Browser/downstream caching, site-domain source Header rule on the source path. It carries over to the transformed image.
Netlify cache duration, remote source Cache headers on the remote origin (precedence above)
CORS or other headers on a rewritten path Edge function on tha
Полный SKILL.md на GitHub

Установить netlify-image-cdn в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/user-uploads.md

FAQ

Что делает скилл netlify-image-cdn?

Transform, resize, crop, and convert images on demand through Netlify Image CDN at the /.netlify/images endpoint. Use this skill whenever someone asks to optimize images, generate thumbnails or responsive sizes, serve WebP or AVIF automatically, crop to a square or cover box, add blurred placeholders, allow remote image domains, or create a reusable image preset URL. It also applies to setting cache or CORS headers on transformed images, fixing next/image headers on Netlify, and configuring Angular, Astro, Gatsby, Next.js, or Nuxt image optimization on Netlify.

Как установить скилл netlify-image-cdn?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл netlify-image-cdn запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить netlify-image-cdn с