Skip to content

Commit

Permalink
docs: add Nitrogen AIO loader for next/image
Browse files Browse the repository at this point in the history
### Why?

- Help folks find Nitrogen AIO as an option for Image loaders.
  • Loading branch information
chandanpasunoori committed Jul 8, 2024
1 parent 6d92ff8 commit 119dd82
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/02-app/02-api-reference/05-next-config-js/images.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ To learn more about configuring the behavior of the built-in [Image Optimization
- [Sirv](#sirv)
- [Supabase](#supabase)
- [Thumbor](#thumbor)
- [Nitrogen AIO](#nitrogen-aio)

### Akamai

Expand Down Expand Up @@ -240,3 +241,20 @@ export default function thumborLoader({ src, width, quality }) {
return `https://example.com${params.join('/')}${src}`
}
```

### Nitrogen AIO

```js
// Docs: https://docs.n7.io/aio/intergrations/
export default function aioLoader({ src, width, quality }) {
const url = new URL(src)
const params = url.searchParams
const aioParams = params.getAll('aio')
aioParams.push(`w-${width}`)
if (quality) {
aioParams.push(`q-${quality.toString()}`)
}
params.set('aio', aioParams.join(';'))
return url.href
}
```

0 comments on commit 119dd82

Please sign in to comment.