Answers for "next img src"

0

how to add img in next.js

yarn add next-images

// add in next.config.js
const withImages = require('next-images')
module.exports = withImages()

//where the image should go
<img src={require('./my-image.jpg')} />
//or
import img from './my-image.jpg';
export default () => <div>
  <img src={img} />
</div>
Posted by: Guest on June-25-2020
0

image next src url

// next.config.js
module.exports = {
    images: {
        domains: ['images.unsplash.com'],
    },
}

// pages/your_page_file.js
<Image
    alt="The guitarist in the concert."
    src="https://images.unsplash.com/photo-1464375117522-1311d6a5b81f?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=crop&w=2250&q=80"
    width={2250}
    height={1390}
    layout="responsive"
/>
Posted by: Guest on October-07-2021

Browse Popular Code Answers by Language