-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
next/image should infer image aspect ratio at build time #18496
Comments
Width and height are not required. Use the |
@danbeneventano |
I was going to say. There is a comment:
Thus was my original question – since next.js can infer this information at built time, why doesn't it? |
@gajus Next.js cannot infer this information at build time, as we allow you to pass any image URL you want. It does not have to be from the file system. This type of dynamic input cannot be statically analyzed. We're going to explore a way to import images in the future, which will automatically set the width and height. |
I would imagine that 99% of users will want to use <Image src={require('../images/foo.png')} /> It would seems a simple improvement to That said... I believe I can do this myself with a simple wrapper. I think. |
|
Closing in favor of this: |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
It is not clear why does
next/image
require me to addwidth
andheight
values when this information can be easily inferred from the image itself at build time.If there is a rational reason for it, I would at least briefly mention it in the documentation.
The text was updated successfully, but these errors were encountered: