-
Notifications
You must be signed in to change notification settings - Fork 27.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: NextImage should automatically determine width/height for local images #18497
Comments
This is a reason why I cannot use next/image since I need to provide the width and height. It will be great if it can be used with using css width and height (ex. value of 100%) or something similar. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@neilpalima we're landing a change to |
@Timer I don't understand how #18491 is solving the issue tackled by the proposal? 😅 What I'd expect is that if one provides |
it would nice infer |
One idea: we can read the Maybe it's possible to use this at build time, assuming it doesn't negatively affect build time with lots of images. |
@Nicoowr I like the idea, but won't a custom wrapper require loading the image to get its aspect ratio and do the calculation? which means loading the image twice everytime an image needs to be displayed. |
I was checking to open a issue and found this. |
Same here, it would be nice that the next image works as a normal |
Was struggling with keeping aspect ratios of my images, this is what I ended up using:
|
@7ruth Your solution is a terrific workaround, thank you. Except, I needed to add a |
Could this issue be closed so there's no confusion? For anyone reading this, this feature has been added in Next 11 https://nextjs.org/blog/next-11#automatic-size-detection-local-images cc: @leerob |
Feature request
It'd be really cool if NextImage automatically configured
width
andheight
for local images, as well as automatically hashing the image.Describe the solution you'd like
Describe alternatives you've considered
N/A
Additional context
Currently, you have to manually set the width and height for a local image. Plus, the image paths aren't statically verified like an import would be.
The text was updated successfully, but these errors were encountered: