-
Notifications
You must be signed in to change notification settings - Fork 27.6k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Dynamic image support #26761
Comments
From Next 11, Next.js automatically calculates width and height if you import it like: import SomeImage from "/public/img/img.jpg" But yes, it won't work with user-uploaded images. You have two options right now. 1.dynamically get width and height of images and add it to the Also, the new w3 standards recommend adding width and height to an image, so browsers can repaint it easily without cumulative layout shift. |
Thanks. But it would be nice if nextJS automatically calculate width and height of dynamic images. |
ObjectFit also sets the image position absolute which cause the image to take all the space. is there any parent element property to make sure objectFit only takes parent element's width and height? |
Yes, would be a nice feature, but I'm not sure it will happen or not. You have to add |
Thanks did that and worked. |
You can close this issue |
I will wait for the core member to see this because the main issues isn't solved yet. It will be better to nextjs automatically calculating width and height of images from all source. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the feature you'd like to request
In a dynamic app where images can have different width and height. for example I may have posts from different users where they upload images of different size, width, height and extension. nextjs current Image component requires a numeric value of width and height. if I set the height to something it causes most of the images to show inappropriately. in other words if I set the image width and height to 500 and original image width is 500 but height is 700 it makes the image looks odd.
Describe the solution you'd like
Remove the numeric value requirement for Image component. if possible make sure Image components automatically detect intrinsic values.
Describe alternatives you've considered
I don't have any alternative solution.
The text was updated successfully, but these errors were encountered: