@@ -48,7 +48,7 @@ const handler = async (event) => {
48
48
} else {
49
49
isRemoteImage = true
50
50
// Remote images need to be in the allowlist
51
- let allowedDomains = config . images ?. domains || [ ]
51
+ let allowedDomains = config . domains || [ ]
52
52
53
53
if ( process . env . NEXT_IMAGE_ALLOWED_DOMAINS ) {
54
54
console . log ( 'Combining `NEXT_IMAGE_ALLOWED_DOMAINS` with any domains found in `next.config.js`' )
@@ -84,20 +84,6 @@ const handler = async (event) => {
84
84
return { statusCode : 400 , body : 'Source does not appear to be an image' }
85
85
}
86
86
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
-
101
87
let { ext } = type
102
88
103
89
// For unsupported formats (gif, svg) we redirect to the original
@@ -122,8 +108,8 @@ const handler = async (event) => {
122
108
// make it return that format.
123
109
const { info, data : imageBuffer } = await sharp ( bufferData )
124
110
. 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' } )
127
113
. webp ( { quality, force : ext === 'webp' } )
128
114
. avif ( { quality, force : ext === 'avif' } )
129
115
. resize ( width , null , { withoutEnlargement : true } )
0 commit comments