Questions tagged [nextjs-image]

next/image is the built-in image component in NextJS 10. Please, do not use this tag for questions related to the next-images package (use [next-images] instead).

next/image is the Next.js team's solution to performant images on the web. The Next.js Image Component is just a drop-in replacement for the HTML <img> element, evolved for the modern web.

When using the next/image component, images are automatically lazy-loaded, meaning they're only rendered when the user is close to seeing the image. This prevents loading that 30% of images outside of the initial viewport.

The Automatic Image Optimization allows for resizing, optimizing, and serving images in modern formats like WebP when the browser supports it. This avoids shipping large images to devices with a smaller viewport. It also allows Next.js to automatically adopt future image formats and serve them to browsers that support those formats.

Automatic Image Optimization works with any image source. Even if the image is hosted by an external data source, like a CMS, it can still be optimized.

For usage and available props visit https://nextjs.org/docs/api-reference/next/image

310 questions
0
votes
0 answers

Can't import Image from 'next/image'

I've created a NextJS project, but I'm not able to import the Image component. I've already imported other components from NextJS (e.g. Head, Link, etc.) and everything works fine. Now, I'm having troubles with the Image component. Does anyone know…
Enricopro
  • 11
  • 1
0
votes
1 answer

Next Js v10 rendering Image

Recently, Next.js version 10 is released with the newest Image element, which is super helpful for a website with a lot of images! I get an HTML response from the server something like: HTML = "

Some Random text

0
votes
3 answers

NextJS Image Component and Image Optimization is not working

I am new to NextJS. I just saw this new image optimization feature in the NextJS documentation, but it doesn't work for me. Here's my code. The part that works and the part that doesn't is specified in the code. import Image from…
Pranta
  • 2,928
  • 7
  • 24
  • 37
0
votes
3 answers

How Next.js new Image component detect device size if layout prop value is "responsive"?

On desktop, it detects the current viewport size correctly, but if I simulate mobile view on Chrome Dev Tools, the Image component detects the wrong device size. I'd like to know how the Image component detects device sizes.
Daniel Li
  • 170
  • 1
  • 12
-1
votes
0 answers

Upload video in next js but when I create build on local and deploy to server it shows me not 404 not found. But it works fine on my local path.

Upload video in next js but when I create build on local and deploy to server it shows me not 404 not found. But it works fine on my local path. ..... enter image description here I am trying to show video on local path and resolve the 404 not found…
-1
votes
1 answer

Unable to view Image in browser from public/assets folder in Next.js

My Code is as follows: import Image from "next/image"; import React from "react"; import { ProcessImg } from "../public/assets/process_img.png";
-1
votes
2 answers

Image is missing required "src" property. Make sure you pass "src" in props to the `next/image` component. İ got really stuck this time

Image is missing required "src" property. Make sure you pass "src" in props to the next/image component. İ got really stuck this time. i've checked everywhere but didnt fixed it import Link from "next/link"; import Image from "next/image"; import {…
-1
votes
1 answer

How to break CORS policy for images in nextjs

In my nextjs project, I'm using component from next/image. I'm accessing images from a CDN hosted in digitalOcean server. For some reason CORS policy for the CDN isn't working properly, so images don't load in my browser (using Chrome).…
Ishrat
  • 251
  • 1
  • 6
  • 16
-2
votes
3 answers

How to make nextjs circular

How do you create a circular image using nextjs Image? I have found that the solution involving wrapping the image in divs with border radius and hidden overflow isn't working. import Image from 'next/image'
421
  • 203
  • 1
  • 5
  • 13
1 2 3
20
21