Skip to content

Commit

Permalink
updat image loader
Browse files Browse the repository at this point in the history
  • Loading branch information
haochengxu committed Sep 24, 2023
1 parent 8521b8b commit cec9c88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions image-loader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function imageLoader({
src,
width,
quality,
}: {
src: string
width: number
quality?: number
}) {
// const params = ['f_auto', 'c_limit', `w_${width}`, `q_${quality || 'auto'}`]
return src.startsWith('/') ? src.substring(1) : `${src}`
}
6 changes: 3 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
const nextConfig = {
output: 'export',
images: {
unoptimized: true,
basePath: '',
}
loader: 'custom',
loaderFile: './image-loader.ts',
},

// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,
Expand Down

0 comments on commit cec9c88

Please sign in to comment.