Replies: 10 comments 2 replies
-
Similar feature request regarding custom image loader: #35016 |
Beta Was this translation helpful? Give feedback.
-
Hi, I have looked into your feature request but I'm not quite understand why would you think these 2 feature requests are similar. |
Beta Was this translation helpful? Give feedback.
-
I see, misunderstood your question sorry. If you're trying to skip the custom image loader and apply a pre-generated string for |
Beta Was this translation helpful? Give feedback.
-
No worries, so far it seems either I need to fork the 'next/image' component and implement a feature patch or build a custom image component from the ground up. |
Beta Was this translation helpful? Give feedback.
-
Seems like more control over |
Beta Was this translation helpful? Give feedback.
-
Another scenario where this could be relevant: We have our own image proxy for handling image resizing. This proxy requires credentials that we do not want to expose to the user client so we would like to pass need to generate a predefined srcset definition server-side. Providing our own explicit source set to our next/image's will solve this issue. |
Beta Was this translation helpful? Give feedback.
-
It is very usefull to have an Because the management of responsive images is not only limited to the size but also the fact that we can have different images for different screen sizes. For now this is our usecase and next/image doesn't permit this :( So please @leerob, take note on this to feature request. It's very usefull and helpfull. I hope it will be supported soon. 🙏 |
Beta Was this translation helpful? Give feedback.
-
Hi! I have a simmilar use case. In the project I'm working on, several image resizes are generated ahead of time when the user uploads an image to the CMS. We tried to hack a solution by specifying an array of next.js/packages/next/src/shared/lib/get-img-props.ts Lines 522 to 527 in 13af19a Right now, if a next/image is unoptimized, it eats the user next.js/packages/next/src/shared/lib/get-img-props.ts Lines 204 to 206 in 13af19a When trying to test the unoptimized approach, we found another hacky way to get the I don't like this "solution" since I cannot assume that bypassing next/image's internal logic will result in 0 errors now and in future versions of the component, and a proper way to set custom |
Beta Was this translation helpful? Give feedback.
-
Hello all, I am using Next.js + Sanity.io and I've found a solution in the package next-sanity-image by @lorenzodejong. best, |
Beta Was this translation helpful? Give feedback.
-
@owenhoskins the next-sanity-image package actually leans on dynamic generation of Sanity CDN URL's. Sanity allows dynamically resizing by setting query parameters on the request URL. For example: '?w=100&h=50' yields into an image resized to 100x50. It does so based on the configured 'sizes' in the next.config.js This does seem inherently different from the approaches the other replies are leaning towards, where a predefined srcSet is passed to the next/image component as-is. |
Beta Was this translation helpful? Give feedback.
-
Describe the feature you'd like to request
I would like to optionally abandon automatic responsive image optimization provided by Next.js and set source set by my own, the reason is that the CMS I'm going to connect to already provides the image source and source set that it generates, and they are already hosted on CDN.
In the meanwhile, I'm greedy so I still want to keep features like placeholder auto switching and image lazy loading etc that the
next/image
provides as they are awesome.Describe the solution you'd like
I tried to mark the image component as
unoptimized: true
and pass explicitsrcSet
tonext/image
but it seems the explicitsrcSet
is not supported currently. I hope it works.Describe alternatives you've considered
Is it a good idea to make
srcSet
accept explicit source set?Beta Was this translation helpful? Give feedback.
All reactions