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
1 answer

How to auto configure images in next.js

I am using next.js for the frontend of my blockchain application and am using IPFS to store my images. Whenever I try to display an image with the Image component, it shows hostname not configured error. I know how to configure a hostname by editing…
bigfoot
  • 59
  • 2
  • 14
0
votes
1 answer

How to trigger images to load in background using Next.js

We have a GIF that is 11mb in the homepage, a bit large, but it is a business requirement. I wish to start downloading the GIF in background, while the "Loading" page is playing out, so that when the home is shown after 2 seconds, the GIF is already…
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
0
votes
1 answer

Nextjs Image component wont load my images

Nextjs Image component wont load my images, I've tried everything I've come across still nothing.
{output?.map((item) => (
{console.log(`${apiUrl}${item.localImage}`)} { return…
Youzef
  • 616
  • 1
  • 6
  • 23
0
votes
0 answers

Problems displaying images from Firebase Storage /Hosting using Nextjs

I'm pamanndo for a few hours to try to understand why the image is displayed locally, but is not being printed on the page in production. I used as a guide the repo https://github.com/ankeshs/next-firebase-boilerplate, I made some updates and…
0
votes
1 answer

How to show a placeholder image in nextjs image component

I am trying to show images from the API calls. I want to show a placeholder image in case there are no images or any errors. For that, I wrote this code, const [errorImage, setErrorImage] = useState(null);
Anwar Hossain
  • 201
  • 1
  • 4
  • 16
0
votes
0 answers

How to convert blob into base64 in nextJs

I am getting the Image from an API response. I am trying to the get the image and display in the UI. import FileReader from 'filereader'; export default async (req, res) => { const { method } = req; switch (method) { case 'GET': try { …
Siva Sai
  • 319
  • 2
  • 5
  • 21
0
votes
2 answers

How do I use an image from an external domain in Next.js?

I'm trying to use the component in a Next.js project that references an external domain. I'm just working locally. I'm instructed to add images.domains to my next.config.js file but that doesn't seem to…
Michael Lynch
  • 2,682
  • 3
  • 31
  • 59
0
votes
1 answer

next/image Un-configured Host with IP domain

i built site using NextJS and image is host at other dev server that run with IP. THe file is public accessible by the image path : http://xxx.xx.xxx.xxx:8080/storage/user-profile/61d41e2b05de9_WhatsApp%20Image%202022-01-02%20at%2021.46.03.jpeg But…
user2601660
  • 29
  • 10
0
votes
3 answers

can't fetch image from api in nextjs - TypeError: Cannot read properties of undefined (reading 'map') NEXTJS

I can't seem to fetch an image from the api, not sure what's going on. What am I missing here? I also keep getting this error in the browser. Image is missing required "src" property. Make sure you pass "src" in props to the next/image component.…
someone
  • 661
  • 1
  • 9
  • 26
0
votes
1 answer

What is the best way to provide source to Nextjs' Image?

I am working on a website (Nextjs) that has a huge amount of images. So in order to have better performance, Image optimization is essential. I checked and saw that the Image component of nextjs makes many qualities and sizes from images in srcset.…
Pouryak
  • 387
  • 1
  • 3
  • 8
0
votes
0 answers

NextJS stuck when image is not found

My NextJS 12 App is stuck loading when the image provided doesn't exist, there is a way to solve that? import Image from "next/image"; export default function Home() { return (
Freddx L.
  • 455
  • 2
  • 7
  • 16
0
votes
1 answer

i want to import image from my local storage using next js

recently i am learning next.js. i have some question about import image from my local storage. this is the err ./logo/Iu.jpg TypeError: unsupported file type: undefined (file: undefined) and here is my code import Image from "next/image"; import Iu…
user15927449
0
votes
1 answer

How to update src of tag in NextJS without re-rendering the whole component

I want to change the image of a tag in NextJS by updating its src with a new link, but it shows too many re-renders. Product Image
Anoop V
  • 141
  • 3
  • 10
0
votes
1 answer

Configure hostname for next/image

I am trying to upgrade my NextJS with from next/image. My images are hosted remotely. It seems that for remote images to work, I need to add my domain to the next.config.js. I did it as below: const withTM =…
Igor Shmukler
  • 1,742
  • 3
  • 15
  • 48
0
votes
2 answers

Why is the typeof window check needed in Nextjs Image component

So im making a placeholder image/svg to use Nextjs image component and i copied this code from their repo. Im not very experienced to backend development (mostly frontend) so i had to make research about buffer, streams, window.bto, etc. What i…
Pedro
  • 11
  • 2