Skip to content

Commit

Permalink
docs: add Sirv loader for next/image (#57102)
Browse files Browse the repository at this point in the history
Co-authored-by: Lee Robinson <me@leerob.io>
  • Loading branch information
IgorVaryvoda and leerob authored Dec 24, 2023
1 parent 142e708 commit d4b7c86
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 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 @@ -48,6 +48,7 @@ Alternatively, you can use the [`loader` prop](/docs/pages/api-reference/compone
- [Imgix](#imgix)
- [Thumbor](#thumbor)
- [Sanity](#sanity)
- [Sirv](#sirv)
- [Supabase](#supabase)

### Akamai
Expand Down Expand Up @@ -172,6 +173,20 @@ export default function sanityLoader({ src, width, quality }) {
}
```

### Sirv

```js
// Docs: https://sirv.com/help/articles/dynamic-imaging/
export default function sirvLoader({ src, width, quality }) {
const url = new URL(`https://example.com${src}`);
const params = url.searchParams;
params.set("format", params.getAll("format").join(",") || "optimal");
params.set("w", params.get("w") || width.toString());
params.set("q", (quality || 85).toString());
return url.href;
}
```

### Supabase

```js
Expand Down

0 comments on commit d4b7c86

Please sign in to comment.