Skip to content

Commit

Permalink
Updated example usage of PixelBin custom image loader with f_auto
Browse files Browse the repository at this point in the history
Adding `f_auto` query param in example usage of PixelBin custom image loader
  • Loading branch information
pnutmath committed Apr 10, 2024
1 parent 5bc513b commit 654c46b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 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 @@ -179,10 +179,16 @@ export default function imgixLoader({ src, width, quality }) {
// Doc (Resize): https://www.pixelbin.io/docs/transformations/basic/resize/#width-w
// Doc (Optimise): https://www.pixelbin.io/docs/optimizations/quality/#image-quality-when-delivering
export default function pixelBinLoader({ src, width, quality }) {
return src.replace(
const url = new URL(src)
if (!url.searchParams.has('f_auto')) {
url.searchParams.set('f_auto', 'true')
}
url.pathname = url.pathname.replace(
`/original/`,
`/t.resize(w:${width})~t.compress(q:${quality || 75})/`
);
)
return url.href
}
}
```

Expand Down

0 comments on commit 654c46b

Please sign in to comment.