Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12141

How can I use the next/image for an image where I don't know the width and height?

$
0
0

I want to place an image in a div, but I only want to specify the width and keep the aspect ratio. Here is my code:

<motion.div                initial={{ opacity: 0, transform: "translateZ(0)" }}                animate={{ opacity: 1, transform: "translateZ(0)" }}                transition={{ duration: 1, ease: 'easeInOut' }}                className='w-[400px] md:w-[500px] relative'><Image                    alt={nume}                    layout="responsive"                    objectFit="cover"                    width={200}                    height={200}                    src={poza}                /></motion.div>

What should I do to not get this warning in the console?

Image with src "https://firebasestorage.googleapis.com/...." has legacy prop "objectFit". Did you forget to run the codemod?

Viewing all articles
Browse latest Browse all 12141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>