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

Next.js Image Optimization Increases Filesize Instead of Decreasing it

I have fetched uploaded images from an api that originally has file size of 208kb with resolution of 3488*2633. I have used below code to fetch image from external api const ExternalImage = forwardRef((props,ref) => { const…
designerdarpan
  • 197
  • 1
  • 3
  • 19
0
votes
2 answers

component next/image are not working with CSS

I was trying to make border around an image and my custom css was not working because of Image component css, it was overriding over my custom css and also applied tailwind and bootstrap to fix it but I was unable to fix it. Now I am not getting any…
Suyash
  • 29
  • 7
0
votes
2 answers

Images wont show up in Nextjs and Strapi project

Currently I'm using NextJs as my frontend and Strapi as my CMS for my web application. I've added the following data to my Citizenship collection type in Strapi: This is my code in the NextJs side: export default function Citizenship({ posts }) { …
JJM50
  • 467
  • 1
  • 7
  • 20
0
votes
1 answer

Set next/height full

I have a parent div holding two child div (on with a pic, the other one with text). On screens larger than 768px, the two div are displayed next to each other and the div holding the image will take the whole height defined by the content of the…
quilmes
  • 43
  • 5
0
votes
1 answer

Nextjs Image adds a second ? question mark to image url

if image url already have a query string like this: domain.com/image?id=1234 nextjs Image adds query parameters with an additional question mark. like: domain.com/image?id=1234?format=jpg&width=768 any idea how to resolve this problem?
Ali Hamedani
  • 251
  • 1
  • 6
0
votes
1 answer

Image not loading on specific viewport widths

I have a problem with broken links when using next-image. What's happening is that sometimes my images load on a certain viewport width (say 1200px), but if I shrink it down to mobile size, the image links will be broken. Upon checking the console,…
xyz
  • 1
  • 1
0
votes
1 answer

map on all images on a folder

i am new in nextjs, i am having some problems.. I have 30 images on my public/imgs/myfolder and i want to import them on the easiest way, meaning by, import all 30 without importing by each name... My code is like that: import Image from…
Germano
  • 358
  • 1
  • 2
  • 13
0
votes
1 answer

How to render images of unknown dimensions using next/image from Next.js?

This is my use case: I'll be adding images to a blog post. I can't set fixed dimensions to render those images, because each one may have unique proportions For example: I might upload a square image of 400 x 400 or a rectangular image of 400 x…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
0
votes
0 answers

Image is not showing in next and react?

I have data fetched from API and I want to display an image with Next and React but I can't see the image appear in the screen the alt for the image just showing. I am using next/image instead of HTML img? this is the imaeUrl coming from API…
coder
  • 64
  • 6
0
votes
2 answers

NextJS Image gives a weird positioning

I am trying to change my standard to the NextJS but I cannot find why my images are not rendered properly. This is the basis tag
Maxime Ghéraille
  • 1,465
  • 3
  • 16
  • 31
0
votes
2 answers

Blob images urls with next.js doesn't work

Is there some solution to use blob in next.js ? Previously I used img and blob URL worked well, but now when I'm trying to use Image component blob url doesn't work. I tried to add blob to domains : domains:…
simonOk
  • 1
  • 2
0
votes
1 answer

I cannot deploy to vercel because I get the error: Specified images.domains should be an Array of strings received invalid values ()

When I deploy on vercel I get this error Build error occurred 14:34:33.017 Error: Specified images.domains should be an Array of strings received invalid values (). To get images showing on my screen locally I did these settings: module.exports…
Hannah
  • 35
  • 1
  • 5
0
votes
1 answer

Next JS Image, I cant make the image position to center using tailwind

Hi Im working on a project using next js and tailwind css. I want to center this image but next js seems to ignore flex and justify-center as shown on the image. I want to dynamically pass positions to the (ex. justify-start, justify-end). Any help…
Shugi Yen
  • 141
  • 3
  • 10
0
votes
1 answer

How to abstract next/image from next.js

I'm only using the next/image from Next.js. Is there a way to only install next/image module and not the entire Next.js module. I tried doing the following - "next/image": "^10.0.5", "next/link": "^10.0.5", But after doing npm install I'm getting…
0
votes
0 answers

next/image how to use getInitialProps or get router details on load

I am trying to access query params on page initialization and to be able to force certain pages to pre-load images. This is actually for testing and snapshots, as I want to turn lazy load off and have all images load from the start. However with…
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
1 2 3
20
21