Skip to content

Commit

Permalink
chore(docs): add example of sanity image to loaderFile config (#54529)
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed Aug 25, 2023
1 parent d8b1ad4 commit 6a70ebf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 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 @@ -47,6 +47,7 @@ Alternatively, you can use the [`loader` prop](/docs/pages/api-reference/compone
- [ImageEngine](#imageengine)
- [Imgix](#imgix)
- [Thumbor](#thumbor)
- [Sanity](#sanity)
- [Supabase](#supabase)

### Akamai
Expand Down Expand Up @@ -153,6 +154,24 @@ export default function thumborLoader({ src, width, quality }) {
}
```

### Sanity

```js
// Docs: https://www.sanity.io/docs/image-urls
export default function sanityLoader({ src, width, quality }) {
const prj = 'zp7mbokg'
const dataset = 'production'
const url = new URL(`https://cdn.sanity.io/images/${prj}/${dataset}${src}`)
url.searchParams.set('auto', 'format')
url.searchParams.set('fit', 'max')
url.searchParams.set('w', width.toString())
if (quality) {
url.searchParams.set('q', quality.toString())
}
return url.href
}
```

### Supabase

```js
Expand Down

0 comments on commit 6a70ebf

Please sign in to comment.