๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Next.js

[๋‚ด๋ณด๋‚ด๋ฒˆ] Next.js docs - next/image

๋‚ด๋ณด๋‚ด๋ฒˆ(๋‚ด๊ฐ€ ๋ณด๋ ค๊ณ  ๋‚ด๊ฐ€ ๋ฒˆ์—ญํ•œ...) Next.js docs

2021๋…„ 3์›” 31์ผ ๊ธฐ์ค€ Next.js ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋ฒˆ์—ญํ–ˆ๋‹ค.
2021๋…„ 7์›” 12์ผ ๊ธฐ์ค€ Next.js ๊ณต์‹ ๋ฌธ์„œ๋กœ ์—…๋ฐ์ดํŠธํ–ˆ๋‹ค. (v11.0.0)
2022๋…„ 3์›” 7์ผ ๊ธฐ์ค€ Next.js ๊ณต์‹ ๋ฌธ์„œ(v12.1.0)์€ ์•„๋ž˜์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.  

 

2022.03.07 - [Next.js] - [๋‚ด๋ณด๋‚ด๋ฒˆ] Next.js docs - next/image (v12.1.0)

 

[๋‚ด๋ณด๋‚ด๋ฒˆ] Next.js docs - next/image (v12.1.0)

๋‚ด๋ณด๋‚ด๋ฒˆ( ๋‚ด๊ฐ€ ๋ณด๋ ค๊ณ  ๋‚ด๊ฐ€ ๋ฒˆ์—ญํ•œ... ) Next.js docs 2022๋…„ 03์›” 07์ผ ๊ธฐ์ค€ Next.js ๊ณต์‹ ๋ฌธ์„œ๋กœ ์—…๋ฐ์ดํŠธํ–ˆ๋‹ค. (v12.1.0) ์ด์ „ ๋ฒ„์ „ ๋ฌธ์„œ๋Š” ์•„๋ž˜์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. 2021.04.01 - [Next.js] - [๋‚ด๋ณด๋‚ด๋ฒˆ] Ne..

birdmee.tistory.com

โ€ป ์˜์–ด ์ „๊ณต์ž๋„ ํ•ด์™ธ ์œ ํ•™ํŒŒ๋„ ์•„๋‹ˆ๊ธฐ์— ๋ฒˆ์—ญ์—๋Š” ์˜์—ญ, ์˜ค์—ญ, ๊ตฌ๊ธ€ ๋ฒˆ์—ญ์ด ๋ฌด์ˆ˜ํžˆ ๋งŽ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ํ˜ผ์ž ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด๊ฐ€๋ฉฐ ๋ฒˆ์—ญํ•˜๋‹ค ๋ณด๋‹ˆ ์˜คํƒ€๋„ ๋งŽ์„ ์ˆ˜ ์žˆ๋‹ค. ์ •ํ™•ํ•œ ๋‚ด์šฉ์€ ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ง์ ‘ ์‚ดํŽด๋ณด๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์ •๋ณด๋“ค์„ ๋” ์ฐพ์•„๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค.

(ํ•˜์ง€๋งŒ ๋Œ“๊ธ€ ํ”ผ๋“œ๋ฐฑ๋„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค๐Ÿ˜ƒ )

Next.js ๊ณต์‹๋ฌธ์„œ ํ™•์ธํ•˜๊ธฐ>>

 

next/image | Next.js

Enable Image Optimization with the built-in Image component.

nextjs.org


Before moving forward, we recommend you to read Image Optimization first.
๊ณ„์† ์ง„ํ–‰ํ•˜๊ธฐ ์ „์— Image Optimization์— ๋Œ€ํ•ด ๋จผ์ € ์ฝ๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค. 

Image Optimization์— ๋Œ€ํ•ด ๋ฒˆ์—ญํ•œ ๊ธ€์„ ์ฐธ๊ณ ํ•  ์ˆ˜ ์žˆ๋‹ค. 

2021.03.31 - [Next.js] - [๋‚ด๋ณด๋‚ด๋ฒˆ] Next.js docs - Image Component and Image Optimization

 

[๋‚ด๋ณด๋‚ด๋ฒˆ] Next.js docs - Image Component and Image Optimization

๋‚ด๋ณด๋‚ด๋ฒˆ( ๋‚ด๊ฐ€ ๋ณด๋ ค๊ณ  ๋‚ด๊ฐ€ ๋ฒˆ์—ญํ•œ... ) Next.js docs 2021๋…„ 3์›” 31์ผ ๊ธฐ์ค€ Next.js ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋ฒˆ์—ญํ–ˆ๋‹ค. โ€ป ์˜์–ด ์ „๊ณต์ž๋„ ํ•ด์™ธ ์œ ํ•™ํŒŒ๋„ ์•„๋‹ˆ๊ธฐ์— ๋ฒˆ์—ญ์—๋Š” ์˜์—ญ, ์˜ค์—ญ, ๊ตฌ๊ธ€ ๋ฒˆ์—ญ์ด ๋ฌด์ˆ˜ํžˆ ๋งŽ์„ ์ˆ˜

birdmee.tistory.com

 

Image Optimization can be enabled via the <Image /> component exported by next/image.

Image Optimization์€ next/image์—์„œ exportํ•œ <Image /> ์ปดํฌ๋„ŒํŠธ๋ฅผ ํ†ตํ•ด์„œ ํ™œ์„ฑํ™” ํ•  ์ˆ˜ ์žˆ๋‹ค.

 

Usage

For an example, consider a project with the following files:

์•„๋ž˜์™€ ๊ฐ™์€ ํŒŒ์ผ์„ ๊ฐ–๊ณ  ์žˆ๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ ์˜ˆ๋กœ ๋“ค๋ฉด: 

  • pages/index.js
  • public/me.png

We can serve an optimized image like so:

์ตœ์ ํ™”๋œ ์ด๋ฏธ์ง€๋ฅผ ์ด๋ ‡๊ฒŒ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋‹ค:

import Image from 'next/image'
import profilePic from '../public/me.png'

function Home() {
  return (
    <>
      <h1>My Homepage</h1>
      <Image src={profilePic} alt="Picture of the author" />
      <p>Welcome to my homepage!</p>
    </>
  )
}

export default Home

Required Props 

The <Image /> component requires the following properties.

<Image /> ์ปดํฌ๋„ŒํŠธ๋Š” ์•„๋ž˜์˜ ์†์„ฑ๋“ค์ด ์š”๊ตฌ๋œ๋‹ค: 

src

Required and must be one of the following:

  1. A statically imported image file, as in the example code above, or
  2. A path string. This can be either an absolute external URL, or an internal path depending on the loader.

When using an external URL, you must add it to domains in next.config.js.

์•„๋ž˜์˜ ์‚ฌํ•ญ ์ค‘ ํ•œ ๊ฐ€์ง€๋Š” ๋ฐ˜๋“œ์‹œ ์š”๊ตฌ๋œ๋‹ค:

1. ์œ„์˜ ์˜ˆ์‹œ ์ฝ”๋“œ์ฒ˜๋Ÿผ ์ •์ ์œผ๋กœ ๊ฐ€์ ธ์˜จ ์ด๋ฏธ์ง€ ํŒŒ์ผ์ด๋‚˜

2. ๊ฒฝ๋กœ ์ŠคํŠธ๋ง. ์ด๊ฒƒ์€ ์™ธ๋ถ€ ์ ˆ๋Œ€ URL์ด๊ฑฐ๋‚˜ loader์— ๋”ฐ๋ฅธ ๋‚ด๋ถ€ ๊ฒฝ๋กœ์ผ์ˆ˜๋„ ์žˆ๋‹ค. (ํ•˜๋‹จ์—์„œ loader ๊ด€๋ จ ํ•ญ๋ชฉ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Œ)

์™ธ๋ถ€ URL์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ next.config.js์˜ domains์— ์ถ”๊ฐ€ํ•ด์•ผ๋งŒ ํ•œ๋‹ค.

width

The width of the image, in pixels. Must be an integer without a unit.

Required, except for statically imported images, or those with layout="fill".

์ด๋ฏธ์ง€์˜ ํ”ฝ์…€ ๋„ˆ๋น„. ๋‹จ์œ„๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ •์ˆ˜ํ˜•์ด์–ด์•ผ๋งŒ ํ•œ๋‹ค. 

์ •์ ์œผ๋กœ ๊ฐ€์ ธ์˜ค๋Š” ์ด๋ฏธ์ง€๋‚˜ layout="fill"์ด ์•„๋‹Œ ๊ฒฝ์šฐ๋ฅผ ์ œ์™ธํ•˜๊ณ  ์š”๊ตฌ๋œ๋‹ค. 

height

The height of the image, in pixels. Must be an integer without a unit.

Required, except for statically imported images, or those with layout="fill".

์ด๋ฏธ์ง€์˜ ํ”ฝ์…€ ๋†’์ด. ๋‹จ์œ„๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ •์ˆ˜ํ˜•์ด์–ด์•ผ๋งŒ ํ•œ๋‹ค.

์ •์ ์œผ๋กœ ๊ฐ€์ ธ์˜ค๋Š” ์ด๋ฏธ์ง€๋‚˜ layout="fill"์ด ์•„๋‹Œ ๊ฒฝ์šฐ๋ฅผ ์ œ์™ธํ•˜๊ณ  ์š”๊ตฌ๋œ๋‹ค. 

 

Optional Props

The <Image /> component optionally accepts the following properties.

<Image /> ์ปดํฌ๋„ŒํŠธ์— ์„ ํƒ์ ์œผ๋กœ ์•„๋ž˜์™€ ๊ฐ™์€ ์†์„ฑ๋“ค์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค.

layout

The layout behavior of the image as the viewport changes size. Defaults to intrinsic.

When fixed, the image dimensions will not change as the viewport changes (no responsiveness) similar to the native img element.

When intrinsic, the image will scale the dimensions down for smaller viewports but maintain the original dimensions for larger viewports.

When responsive, the image will scale the dimensions down for smaller viewports and scale up for larger viewports.

When fill, the image will stretch both width and height to the dimensions of the parent element, usually paired with the objectFit property.

๋ทฐํฌํŠธ์˜ ํฌ๊ธฐ๊ฐ€ ๋ณ€๊ฒฝ๋  ๋•Œ ์ด๋ฏธ์ง€์˜ ๋ ˆ์ด์•„์›ƒ ๋™์ž‘์ด๋‹ค. (layout ์†์„ฑ์˜ ๋™์ž‘์„ ์˜๋ฏธํ•˜๋Š” ๋“ฏํ•จ. ) ๊ธฐ๋ณธ๊ฐ’์€ intrinsic(๊ณ ์œ ์˜, ๋ณธ์งˆ์ ์ธ: ๋„ค์ด๋ฒ„ ์‚ฌ์ „) 

๊ฐ’์ด fixed์ธ ๊ฒฝ์šฐ, native img ์š”์†Œ์™€ ๋น„์Šทํ•˜๊ฒŒ ๋ทฐํฌํŠธ์˜ ํฌ๊ธฐ๊ฐ€ ๋ณ€ํ•ด๋„(๋ฐ˜์‘ ์—†์Œ - ๋ฐ˜์‘ํ˜•์ด ์•„๋‹ˆ๋ผ๋Š” ์˜๋ฏธ ๊ฐ™์Œ) ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ๊ฐ€ ๋ณ€ํ•˜์ง€ ์•Š๋Š”๋‹ค. 

๊ฐ’์ด intrinsic์ธ ๊ฒฝ์šฐ, ์ด๋ฏธ์ง€๋Š” ์ž‘์€ ๋ทฐํฌํŠธ์—์„œ๋Š” ํฌ๊ธฐ๊ฐ€ ์ค„์–ด๋“ค์ง€๋งŒ ๋” ํฐ ๋ทฐํฌํŠธ์—์„œ๋Š” ๋ณธ๋ž˜์˜ ํฌ๊ธฐ๋ฅผ ์œ ์ง€ํ•  ๊ฒƒ์ด๋‹ค. 

๊ฐ’์ด responsive์ธ ๊ฒฝ์šฐ, ์ด๋ฏธ์ง€๊ฐ€ ์ž‘์€ ๋ทฐํฌํŠธ์—์„œ๋Š” ํฌ๊ธฐ๊ฐ€ ์ค„์–ด๋“ค๊ณ  ๋” ํฐ ๋ทฐํฌํŠธ์—์„œ๋Š” ํฌ๊ธฐ๊ฐ€ ์ปค์ง„๋‹ค. 

๊ฐ’์ด fill์ธ ๊ฒฝ์šฐ, ๋ถ€๋ชจ ์š”์†Œ์˜ ํฌ๊ธฐ์— ๋งž์ถฐ ๋„ˆ๋น„์™€ ๋†’์ด๊ฐ€ ๋Š˜์–ด๋‚˜๋Š”๋ฐ, ๋ณดํ†ต์€ object-fit๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•œ๋‹ค.  

 

Try it out:

loader

A custom function used to resolve URLs. Defaults to images object in next.config.js.

loader is a function returning a string, given the following parameters:

URL์„ ํ™•์ธํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์‚ฌ์šฉ์ž ์ง€์ • ํ•จ์ˆ˜. ๊ธฐ๋ณธ ๊ฐ’์€ next.config.js์˜ images ๊ฐ์ฒด์ด๋‹ค. 

loader๋Š”  ์•„๋ž˜์™€ ๊ฐ™์€ ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ์ฃผ์–ด์ง€๋ฉด ๋ฌธ์ž์—ด์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ด๋‹ค: 

sizes

A string mapping media queries to device sizes. Defaults to 100vw.

We recommend setting sizes when using layout="responsive" or layout="fill" and your image will not be the same width as the viewport.

Learn more.

๋ฏธ๋””์–ด ์ฟผ๋ฆฌ๋ฅผ ๊ธฐ๊ธฐ ํฌ๊ธฐ์— ๋งคํ•‘ํ•˜๋Š” ๋ฌธ์ž์—ด์ด๋‹ค. ๊ธฐ๋ณธ ๊ฐ’์€ 100vw์ด๋‹ค.

layout="responsive"๋‚˜ layout="fill"์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ํฌ๊ธฐ๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•œ๋‹ค. ์ด๋ฏธ์ง€๋Š” ๋ทฐํฌํŠธ์™€ ๋„ˆ๋น„๊ฐ€ ๊ฐ™์ง€ ์•Š์„ ๊ฒƒ์ด๋‹ค.  

quality

The quality of the optimized image, an integer between 1 and 100 where 100 is the best quality. Defaults to 75.

์ตœ์ ํ™”๋œ ์ด๋ฏธ์ง€์˜ ํ’ˆ์งˆ๋กœ, 1์—์„œ 100 ์‚ฌ์ด์˜ ์ •์ˆ˜์ด๋ฉฐ 100์ด ์ตœ์ƒ์˜ ํ’ˆ์งˆ์ด๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ 75์ด๋‹ค. 

priority

When true, the image will be considered high priority and preload.

Should only be used when the image is visible above the fold. Defaults to false.

true์ธ ๊ฒฝ์šฐ ์ด๋ฏธ์ง€๊ฐ€ ๋†’์€ ์šฐ์„  ์ˆœ์œ„์™€ preload๋กœ ๊ฐ„์ฃผ๋œ๋‹ค. 

์ด๋ฏธ์ง€๊ฐ€ ์›น ์‚ฌ์ดํŠธ ์ƒ๋‹จ๋ถ€*์— ๋ณด์—ฌ์ ธ์•ผํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ false์ด๋‹ค. 

(*above the fold: ์›น ์‚ฌ์ดํŠธ์—์„œ ์Šคํฌ๋กค์„ ๋‚ด๋ฆฌ์ง€ ์•Š๊ณ  ์ œ์ผ ๋จผ์ € ๋ณผ ์ˆ˜ ์žˆ๋Š” ์˜์—ญ, 1๋ฉด์˜ ์ƒ๋‹จ๋ถ€ - ๋„ค์ด๋ฒ„ ์˜คํ”ˆ์‚ฌ์ „)

placeholder

A placeholder to use while the image is loading, possible values are 'blur' or 'empty'. Defaults to empty.

When blur, the blurDataURL property will be used as the placeholder. If src is an object from a static import and the imported image is jpg, png, or webp, then blurDataURL will automatically be populated.

For dynamic images, you must provide the blurDataURL property. Solutions such as Plaiceholder can help with base64 generation.

When empty, there will be no placeholder while the image is loading, only empty space.

์ด๋ฏธ์ง€๊ฐ€ ๋กœ๋“œ๋˜๋Š” ๋™์•ˆ ์‚ฌ์šฉํ•  placeholder๋กœ ๊ฐ€๋Šฅํ•œ ๊ฐ’์€ blur๋‚˜ empty์ด๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ empty. 

blur์ผ ๋•Œ, blurDataURL ์†์„ฑ์ด placeholder๋กœ ์‚ฌ์šฉ๋  ๊ฒƒ์ด๋‹ค. ๋งŒ์ผ src๊ฐ€ ์ •์ ์œผ๋กœ ๊ฐ€์ ธ์˜ค๋Š” ๊ฐœ์ฒด์ด๊ณ  ์ด๋ฏธ์ง€์˜ ํ™•์žฅ์ž๊ฐ€ jpg, png ํ˜น์€ webp์ธ ๊ฒฝ์šฐ, blurDataURL์€ ์ž๋™์œผ๋กœ ์ฑ„์›Œ์งˆ ๊ฒƒ์ด๋‹ค. 

empty์ผ ๋•Œ, ์ด๋ฏธ์ง€๊ฐ€ ๋กœ๋“œ๋˜๋Š” ๋™์•ˆ ์–ด๋–ค placeholder๋„ ์—†์„ ๊ฒƒ์ด๋ฉฐ ๋นˆ ๊ณต๊ฐ„๋งŒ ๋ณด์—ฌ์งˆ ๊ฒƒ์ด๋‹ค. 

Try it out:

Advanced Props

In some cases, you may need more advanced usage. The <Image /> component optionally accepts the following advanced properties.

์–ด๋–ค ๊ฒฝ์šฐ์—์„œ๋Š” ๋” ๊ณ ๊ธ‰ ์‚ฌ์šฉ๋ฒ•์ด ํ•„์š”ํ•  ์ˆ˜๋„ ์žˆ๋‹ค. <Image /> ์ปดํฌ๋„ŒํŠธ๋Š” ์„ ํƒ์ ์œผ๋กœ ์•„๋ž˜์™€ ๊ฐ™์€ ๊ณ ๊ธ‰ ์†์„ฑ๋“ค์„ ํ—ˆ์šฉํ•œ๋‹ค. 

 

objectFit

The image fit when using layout="fill".

Learn more

layout="fill" ์‚ฌ์šฉ์‹œ ์ด๋ฏธ์ง€ ๋งž์ถค

 

objectPosition

The image position when using layout="fill".

Learn more 

layout="fill" ์‚ฌ์šฉ์‹œ ์ด๋ฏธ์ง€ ์œ„์น˜

 

loading

Attention: This property is only meant for advanced usage. Switching an image to load with eager will normally hurt performance.
We recommend using the priority property instead, which properly loads the image eagerly for nearly all use cases.
์ฃผ์˜: ์ด ์†์„ฑ์€ ๊ณ ๊ธ‰ ์‚ฌ์šฉ๋ฒ•์„ ์œ„ํ•จ์ด๋‹ค. ๋Œ€๊ฐœ ์ด๋ฏธ์ง€๋ฅผ ๋กœ๋“œํ•˜๊ธฐ ์œ„ํ•œ loading ๊ฐ’์„ eagar๋กœ ๋ฐ”๊พธ๋ฉด ์„ฑ๋Šฅ ์ €ํ•˜์— ์˜ํ–ฅ์„ ๋ฏธ์นœ๋‹ค. (์•„๋ž˜์˜ ์†์„ฑ์„ ์„ค๋ช…ํ•˜๋Š” ๋ถ€๋ถ„์„ ๋จผ์ € ์ฝ๋Š” ๊ฒƒ์ด ์ฃผ์˜ ์‚ฌํ•ญ์„ ์ดํ•ดํ•˜๋Š”๋ฐ ๋„์›€์ด ๋จ.)
๋Œ€์‹  ๊ฑฐ์˜ ๋ชจ๋“  ๊ฒฝ์šฐ์— ์ด๋ฏธ์ง€๋ฅผ ์ ์ ˆํžˆ ๋กœ๋“œํ•˜๋Š” priority ์†์„ฑ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•œ๋‹ค. 

The loading behavior of the image. Defaults to lazy.

When lazy, defer loading the image until it reaches a calculated distance from the viewport.

When eager, load the image immediately.

Learn more

์ด๋ฏธ์ง€์˜ ๋กœ๋”ฉ ๋™์ž‘์— ๋Œ€ํ•œ ์†์„ฑ. ๊ธฐ๋ณธ๊ฐ’์€ lazy์ด๋‹ค. 

๊ฐ’์ด lazy์ธ ๊ฒฝ์šฐ, ๋ทฐํฌํŠธ๋กœ๋ถ€ํ„ฐ ๊ณ„์‚ฐ๋œ ๊ฑฐ๋ฆฌ์— ๋„๋‹ฌํ•  ๋•Œ๊นŒ์ง€ ์ด๋ฏธ์ง€ ๋กœ๋”ฉ์„ ๋ฏธ๋ฃฌ๋‹ค. 

๊ฐ’์ด eager์ธ ๊ฒฝ์šฐ, ์ด๋ฏธ์ง€๋ฅผ ์ฆ‰์‹œ ๋กœ๋“œํ•œ๋‹ค. 

blurDataURL

A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".

Must be a base64-encoded image. It will be enlarged and blurred, so a very small image (10px or less) is recommended. Including larger images as placeholders may harm your application performance.

Data URL์€ src ์ด๋ฏธ์ง€๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ๋กœ๋“œ๋˜์ง€ ์ „์— placeholder ์ด๋ฏธ์ง€๋กœ ์‚ฌ์šฉ๋  ๊ฒƒ์ด๋‹ค. placeholder="blur"์™€ ๊ฒฐํ•ฉ๋œ ๊ฒฝ์šฐ์—๋งŒ ์ ์šฉ๋œ๋‹ค. 

base64-encoded ์ด๋ฏธ์ง€์—ฌ์•ผ๋งŒํ•œ๋‹ค. ํ™•๋Œ€๋˜์–ด ํ๋ ค์ง€๋ฏ€๋กœ ์•„์ฃผ ์ž‘์€ ์ด๋ฏธ์ง€(10ํ”ฝ์…€์ด๋‚˜ ๋” ์ž‘์€)๋ฅผ ๊ถŒ์žฅํ•œ๋‹ค. placeholder๋กœ ํฐ ์ด๋ฏธ์ง€๋ฅผ ํฌํ•จํ•˜๋Š” ๊ฒฝ์šฐ ๋‹น์‹ ์˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ฑ๋Šฅ์— ํ•ด๊ฐ€ ๋  ์ˆ˜ ์žˆ๋‹ค. 

Try it out:

You can also generate a solid color Data URL to match the image.

์ด๋ฏธ์ง€์™€ ์ผ์น˜ํ•˜๋„๋ก ๋‹จ์ƒ‰ Data URL์„ ์ƒ์„ฑํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

unoptimized

When true, the source image will be served as-is instead of changing quality, size, or format. Defaults to false.

๊ฐ’์ด true์ธ ๊ฒฝ์šฐ, ์›๋ณธ ์ด๋ฏธ์ง€์˜ ํ’ˆ์งˆ, ํฌ๊ธฐ, ํฌ๋งท์„ ๋ณ€๊ฒฝํ•˜๋Š” ๋Œ€์‹  ๊ทธ๋Œ€๋กœ ์ œ๊ณต ๋  ๊ฒƒ์ด๋‹ค. 

 

Other Props

Other properties on the <Image /> component will be passed to the underlying img element with the exception of the following:

  • style. Use className instead.
  • srcSet. Use Device Sizes instead.
  • decoding. It is always "async".

<Image /> ์ปดํฌ๋„ŒํŠธ์˜ ๋‹ค๋ฅธ ์†์„ฑ๋“ค์€ ์•„๋ž˜์— ๋Œ€ํ•ด์„œ๋Š” ์ œ์™ธํ•˜๊ณ  ๊ธฐ๋ณธ img ์†์„ฑ์œผ๋กœ ์ „๋‹ฌ๋  ๊ฒƒ์ด๋‹ค: 

  • style. ๋Œ€์‹  className์„ ์‚ฌ์šฉํ•˜๋ผ. 
  • srcSet. ๋Œ€์‹  Device Sizes๋ฅผ ์‚ฌ์šฉํ•˜๋ผ.
  • decoding. ํ•ญ์ƒ async์ด๋‹ค.