Outputting images without knowing width/height
Unanswered
Little Stint posted this in #help-forum
Little StintOP
Is there a way to output an image with it's default width and height (of that image without setting any width or height and not knowing the width/height beforehand)? So literally just outputting the image with it's original width/height properties.
Thanks!
<Image
key={j}
src="test.png"
width={?} // don't want to set
height={?} // don't want to set
alt="test_image"
style={{ width: '100%', height: 'auto' }}
/>Thanks!
1 Reply
Sun bear
You should be able to do this using static imports
https://nextjs.org/docs/app/building-your-application/optimizing/images#local-images
https://nextjs.org/docs/app/building-your-application/optimizing/images#local-images