Next.js Discord

Discord Forum

how do I configure the images of my next.config.js file to accept images from google images

Unanswered
Champagne D’Argent posted this in #help-forum
Open in Discord
Champagne D’ArgentOP
i am trying to enable images from the host: lh3.googleusercontent.com. I want to get the profile picture of a logged in user
https://nextjs.org/docs/messages/next-image-unconfigured-host I looked at this documentation. However, I am unsure what pathname means and how it is used.

  images: {
    formats: ["image/avif", "image/webp"],
    remotePatterns: [
      {
        protocol: "https",
        hostname: "lh3.googleusercontent.com",
        port: "",
        pathname: "a/**",
      },
    ],
  }

I have added the above to my next-config file

3 Replies

Thai
The path name specifies the path pattern for remote images
Champagne D’ArgentOP
how do I determine the path patterns
Champagne D’ArgentOP
I solved this by just including hostname and removing everything else.