mirror of
https://github.com/ershisan99/www.git
synced 2025-12-17 05:19:23 +00:00
image optimizations
This commit is contained in:
11
image-loader.js
Normal file
11
image-loader.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const cdnUrl = 'https://balatromp.b-cdn.net'
|
||||
|
||||
export default function bunnyLoader({ src, width, quality }) {
|
||||
if (!cdnUrl) {
|
||||
throw new Error('missing NEXT_PUBLIC_CDN_URL env variable.')
|
||||
}
|
||||
const params = new URLSearchParams()
|
||||
params.set('width', width.toString())
|
||||
params.set('quality', (quality || 100).toString())
|
||||
return `${cdnUrl}${src}?${params.toString()}`
|
||||
}
|
||||
Reference in New Issue
Block a user