@@ -48,7 +48,7 @@ const handler = async (event) => {
4848 } else {
4949 isRemoteImage = true
5050 // Remote images need to be in the allowlist
51- let allowedDomains = config . images ?. domains || [ ]
51+ let allowedDomains = config . domains || [ ]
5252
5353 if ( process . env . NEXT_IMAGE_ALLOWED_DOMAINS ) {
5454 console . log ( 'Combining `NEXT_IMAGE_ALLOWED_DOMAINS` with any domains found in `next.config.js`' )
@@ -84,20 +84,6 @@ const handler = async (event) => {
8484 return { statusCode : 400 , body : 'Source does not appear to be an image' }
8585 }
8686
87- const dimensions = imageSize ( bufferData )
88-
89- if ( width > dimensions . width ) {
90- // We won't upsize images, and to avoid downloading the same size multiple times,
91- // we redirect to the largest available size
92- const Location = `/nextimg/${ url } /${ dimensions . width } /${ q } `
93- return {
94- statusCode : 302 ,
95- headers : {
96- Location,
97- } ,
98- }
99- }
100-
10187 let { ext } = type
10288
10389 // For unsupported formats (gif, svg) we redirect to the original
@@ -122,8 +108,8 @@ const handler = async (event) => {
122108 // make it return that format.
123109 const { info, data : imageBuffer } = await sharp ( bufferData )
124110 . rotate ( )
125- . jpeg ( { quality, mozjpeg : true , force : ext === 'jpg' } )
126- . png ( { quality, palette : true , force : ext === 'png' } )
111+ . jpeg ( { quality, force : ext === 'jpg' } )
112+ . png ( { quality, force : ext === 'png' } )
127113 . webp ( { quality, force : ext === 'webp' } )
128114 . avif ( { quality, force : ext === 'avif' } )
129115 . resize ( width , null , { withoutEnlargement : true } )
0 commit comments