Skip to content

Commit

Permalink
docs: add Nitrogen AIO loader for next/image (#67523)
Browse files Browse the repository at this point in the history
### What?
Adds Nitrogen AIO custom image loader to docs.

### Why?
Help folks find Nitrogen AIO as an option for Image 

@leerob

---------

Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
chandanpasunoori and ijjk authored Sep 19, 2024
1 parent c3475da commit 5f7ff1c
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, window.location.href)
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 5f7ff1c

Please sign in to comment.