Unverified Commit cbaaaeb0 authored by Alex Castle's avatar Alex Castle Committed by GitHub

Add "fill" mode to `next/future/image` (#38855)

This PR adds a `fill` attribute to the future image component, that behave similarly to the fill mode on the existing image component.

Functionally, it mainly adds `position: "absolute"` and `object-fit: "contain"` to the image element, along with `height: "100%"` and `width: "100%"` to preserve the image aspect ratio. All of these can be overwritten by the user, except for `position: "absolute"`, which will throw an error. This is because changing that property without height and width is likely to cause layout shift.

Because we no longer have the wrapper element, this new version of `fill` requires that the user set `overflow: "hidden"` on the parent element themself, if they want that behavior.

This PR also includes several runtime checks to catch instances where the fill mode may provide unexpected results. These runtime checks warn if:
* The image doesn't have the `sizes` attribute and loads much smaller than the viewport
* The containing element does not have `position: "relative"`
* The image height value is 0
Co-authored-by: 's avatarSteven <229881+styfle@users.noreply.github.com>
parent e9d23d70
...@@ -9,6 +9,7 @@ description: Try the latest Image Optimization with the experimental `next/futur ...@@ -9,6 +9,7 @@ description: Try the latest Image Optimization with the experimental `next/futur
| Version | Changes | | Version | Changes |
| --------- | -------------------------------------------- | | --------- | -------------------------------------------- |
| `v12.2.4` | Support for `fill` property added. |
| `v12.2.0` | Experimental `next/future/image` introduced. | | `v12.2.0` | Experimental `next/future/image` introduced. |
</details> </details>
...@@ -36,7 +37,6 @@ Compared to `next/image`, the new `next/future/image` component has the followin ...@@ -36,7 +37,6 @@ Compared to `next/image`, the new `next/future/image` component has the followin
- Removes `layout`, `objectFit`, and `objectPosition` props in favor of `style` or `className` - Removes `layout`, `objectFit`, and `objectPosition` props in favor of `style` or `className`
- Removes `IntersectionObserver` implementation in favor of [native lazy loading](https://caniuse.com/loading-lazy-attr) - Removes `IntersectionObserver` implementation in favor of [native lazy loading](https://caniuse.com/loading-lazy-attr)
- Removes `loader` config in favor of [`loader`](#loader) prop - Removes `loader` config in favor of [`loader`](#loader) prop
- Note: there is no `fill` mode so `width` & `height` props are required
- Note: the [`onError`](#onerror) prop might behave differently - Note: the [`onError`](#onerror) prop might behave differently
The default layout for `next/image` was `intrinsic`, which would shrink the `width` if the image was larger than it's container. Since no styles are automatically applied to `next/future/image`, you'll need to add the following CSS to achieve the same behavior: The default layout for `next/image` was `intrinsic`, which would shrink the `width` if the image was larger than it's container. Since no styles are automatically applied to `next/future/image`, you'll need to add the following CSS to achieve the same behavior:
...@@ -64,13 +64,13 @@ When using an external URL, you must add it to [domains](#domains) in `next.conf ...@@ -64,13 +64,13 @@ When using an external URL, you must add it to [domains](#domains) in `next.conf
The `width` property represents the _rendered_ width in pixels, so it will affect how large the image appears. The `width` property represents the _rendered_ width in pixels, so it will affect how large the image appears.
Required, except for [statically imported images](/docs/basic-features/image-optimization.md#local-images). Required, except for [statically imported images](/docs/basic-features/image-optimization.md#local-images) or images with the [`fill` property](#fill).
### height ### height
The `height` property represents the _rendered_ height in pixels, so it will affect how large the image appears. The `height` property represents the _rendered_ height in pixels, so it will affect how large the image appears.
Required, except for [statically imported images](/docs/basic-features/image-optimization.md#local-images). Required, except for [statically imported images](/docs/basic-features/image-optimization.md#local-images) or images with the [`fill` property](#fill).
## Optional Props ## Optional Props
...@@ -108,6 +108,22 @@ const MyImage = (props) => { ...@@ -108,6 +108,22 @@ const MyImage = (props) => {
} }
``` ```
### fill
A boolean that causes the image to fill the parent element instead of setting [`width`](#width) and [`height`](#height).
The parent element _must_ assign `position: "relative"`, `position: "fixed"`, or `position: "absolute"` style.
By default, the img element will automatically assign `object-fit: "contain"` and `position: "absolute"` styles.
Optionally, `object-fit` can be assigned any other value such as `object-fit: "cover"`. For this to look correct, the `overflow: "hidden"` style should be assigned to the parent element.
See also:
- [position](https://developer.mozilla.org/en-US/docs/Web/CSS/position)
- [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit)
- [object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position)
### sizes ### sizes
A string that provides information about how wide the image will be at different breakpoints. A string that provides information about how wide the image will be at different breakpoints.
......
...@@ -102,6 +102,7 @@ export type ImageProps = Omit< ...@@ -102,6 +102,7 @@ export type ImageProps = Omit<
src: string | StaticImport src: string | StaticImport
width?: number | string width?: number | string
height?: number | string height?: number | string
fill?: boolean
loader?: ImageLoader loader?: ImageLoader
quality?: number | string quality?: number | string
priority?: boolean priority?: boolean
...@@ -121,6 +122,7 @@ type ImageElementProps = Omit<ImageProps, 'src' | 'loader'> & { ...@@ -121,6 +122,7 @@ type ImageElementProps = Omit<ImageProps, 'src' | 'loader'> & {
imgStyle: ImgElementStyle imgStyle: ImgElementStyle
blurStyle: ImgElementStyle blurStyle: ImgElementStyle
isLazy: boolean isLazy: boolean
fill?: boolean
loading: LoadingValue loading: LoadingValue
config: ImageConfig config: ImageConfig
unoptimized: boolean unoptimized: boolean
...@@ -270,6 +272,37 @@ function handleLoading( ...@@ -270,6 +272,37 @@ function handleLoading(
onLoadingCompleteRef.current({ naturalWidth, naturalHeight }) onLoadingCompleteRef.current({ naturalWidth, naturalHeight })
} }
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
if (img.getAttribute('data-nimg') === 'future-fill') {
if (
!img.getAttribute('sizes') ||
img.getAttribute('sizes') === '100vw'
) {
let widthViewportRatio =
img.getBoundingClientRect().width / window.innerWidth
if (widthViewportRatio < 0.6) {
warnOnce(
`Image with src "${src}" has "fill" but is missing "sizes" prop. Please add it to improve page performance. Read more: https://nextjs.org/docs/api-reference/next/future/image#sizes`
)
}
}
if (img.parentElement) {
const { position } = window.getComputedStyle(img.parentElement)
const valid = ['absolute', 'fixed', 'relative']
if (!valid.includes(position)) {
warnOnce(
`Image with src "${src}" has "fill" and parent element with invalid "position". Provided "${position}" should be one of ${valid
.map(String)
.join(',')}.`
)
}
}
if (img.height === 0) {
warnOnce(
`Image with src "${src}" has "fill" and a height value of 0. This is likely because the parent element of the image has not been styled to have a set height.`
)
}
}
const heightModified = const heightModified =
img.height.toString() !== img.getAttribute('height') img.height.toString() !== img.getAttribute('height')
const widthModified = img.width.toString() !== img.getAttribute('width') const widthModified = img.width.toString() !== img.getAttribute('width')
...@@ -295,6 +328,7 @@ export default function Image({ ...@@ -295,6 +328,7 @@ export default function Image({
quality, quality,
width, width,
height, height,
fill,
style, style,
onLoadingComplete, onLoadingComplete,
placeholder = 'empty', placeholder = 'empty',
...@@ -380,132 +414,171 @@ export default function Image({ ...@@ -380,132 +414,171 @@ export default function Image({
// instead console.error(ref) during mount. // instead console.error(ref) during mount.
unoptimized = true unoptimized = true
} else { } else {
if (typeof widthInt === 'undefined') { if (fill) {
throw new Error( if (width) {
`Image with src "${src}" is missing required "width" property.` throw new Error(
) `Image with src "${src}" has both "width" and "fill" properties. Only one should be used.`
} else if (isNaN(widthInt)) {
throw new Error(
`Image with src "${src}" has invalid "width" property. Expected a numeric value in pixels but received "${width}".`
)
}
if (typeof heightInt === 'undefined') {
throw new Error(
`Image with src "${src}" is missing required "height" property.`
)
} else if (isNaN(heightInt)) {
throw new Error(
`Image with src "${src}" has invalid "height" property. Expected a numeric value in pixels but received "${height}".`
)
}
if (!VALID_LOADING_VALUES.includes(loading)) {
throw new Error(
`Image with src "${src}" has invalid "loading" property. Provided "${loading}" should be one of ${VALID_LOADING_VALUES.map(
String
).join(',')}.`
)
}
if (priority && loading === 'lazy') {
throw new Error(
`Image with src "${src}" has both "priority" and "loading='lazy'" properties. Only one should be used.`
)
}
if ('objectFit' in rest) {
throw new Error(
`Image with src "${src}" has unknown prop "objectFit". This style should be specified using the "style" attribute.`
)
}
if ('objectPosition' in rest) {
throw new Error(
`Image with src "${src}" has unknown prop "objectPosition". This style should be specified using the "style" attribute.`
)
}
if (placeholder === 'blur') {
if ((widthInt || 0) * (heightInt || 0) < 1600) {
warnOnce(
`Image with src "${src}" is smaller than 40x40. Consider removing the "placeholder='blur'" property to improve performance.`
) )
} }
if (!blurDataURL) { if (height) {
const VALID_BLUR_EXT = ['jpeg', 'png', 'webp', 'avif'] // should match next-image-loader throw new Error(
`Image with src "${src}" has both "height" and "fill" properties. Only one should be used.`
)
}
if (style?.position && style.position !== 'absolute') {
throw new Error( throw new Error(
`Image with src "${src}" has "placeholder='blur'" property but is missing the "blurDataURL" property. `Image with src "${src}" has both "fill" and "style.position" properties. Images with "fill" always use position absolute - it cannot be modified.`
Possible solutions: )
- Add a "blurDataURL" property, the contents should be a small Data URL to represent the image }
- Change the "src" property to a static import with one of the supported file types: ${VALID_BLUR_EXT.join( if (style?.width && style.width !== '100%') {
',' throw new Error(
)} `Image with src "${src}" has both "fill" and "style.width" properties. Images with "fill" always use width 100% - it cannot be modified.`
- Remove the "placeholder" property, effectively no blur effect )
Read more: https://nextjs.org/docs/messages/placeholder-blur-data-url` }
if (style?.height && style.height !== '100%') {
throw new Error(
`Image with src "${src}" has both "fill" and "style.height" properties. Images with "fill" always use height 100% - it cannot be modified.`
)
}
} else {
if (typeof widthInt === 'undefined') {
throw new Error(
`Image with src "${src}" is missing required "width" property.`
)
} else if (isNaN(widthInt)) {
throw new Error(
`Image with src "${src}" has invalid "width" property. Expected a numeric value in pixels but received "${width}".`
)
}
if (typeof heightInt === 'undefined') {
throw new Error(
`Image with src "${src}" is missing required "height" property.`
)
} else if (isNaN(heightInt)) {
throw new Error(
`Image with src "${src}" has invalid "height" property. Expected a numeric value in pixels but received "${height}".`
) )
} }
} }
if ('ref' in rest) { }
if (!VALID_LOADING_VALUES.includes(loading)) {
throw new Error(
`Image with src "${src}" has invalid "loading" property. Provided "${loading}" should be one of ${VALID_LOADING_VALUES.map(
String
).join(',')}.`
)
}
if (priority && loading === 'lazy') {
throw new Error(
`Image with src "${src}" has both "priority" and "loading='lazy'" properties. Only one should be used.`
)
}
if ('objectFit' in rest) {
throw new Error(
`Image with src "${src}" has unknown prop "objectFit". This style should be specified using the "style" property.`
)
}
if ('objectPosition' in rest) {
throw new Error(
`Image with src "${src}" has unknown prop "objectPosition". This style should be specified using the "style" property.`
)
}
if (placeholder === 'blur') {
if ((widthInt || 0) * (heightInt || 0) < 1600) {
warnOnce( warnOnce(
`Image with src "${src}" is using unsupported "ref" property. Consider using the "onLoadingComplete" property instead.` `Image with src "${src}" is smaller than 40x40. Consider removing the "placeholder='blur'" property to improve performance.`
) )
} }
if (!unoptimized && loader !== defaultLoader) { if (!blurDataURL) {
const urlStr = loader({ const VALID_BLUR_EXT = ['jpeg', 'png', 'webp', 'avif'] // should match next-image-loader
config,
src, throw new Error(
width: widthInt || 400, `Image with src "${src}" has "placeholder='blur'" property but is missing the "blurDataURL" property.
quality: qualityInt || 75, Possible solutions:
}) - Add a "blurDataURL" property, the contents should be a small Data URL to represent the image
let url: URL | undefined - Change the "src" property to a static import with one of the supported file types: ${VALID_BLUR_EXT.join(
try { ','
url = new URL(urlStr) )}
} catch (err) {} - Remove the "placeholder" property, effectively no blur effect
if (urlStr === src || (url && url.pathname === src && !url.search)) { Read more: https://nextjs.org/docs/messages/placeholder-blur-data-url`
warnOnce( )
`Image with src "${src}" has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.` +
`\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader-width`
)
}
} }
}
if ('ref' in rest) {
warnOnce(
`Image with src "${src}" is using unsupported "ref" property. Consider using the "onLoadingComplete" property instead.`
)
}
if ( if (!unoptimized && loader !== defaultLoader) {
typeof window !== 'undefined' && const urlStr = loader({
!perfObserver && config,
window.PerformanceObserver src,
) { width: widthInt || 400,
perfObserver = new PerformanceObserver((entryList) => { quality: qualityInt || 75,
for (const entry of entryList.getEntries()) { })
// @ts-ignore - missing "LargestContentfulPaint" class with "element" prop let url: URL | undefined
const imgSrc = entry?.element?.src || '' try {
const lcpImage = allImgs.get(imgSrc) url = new URL(urlStr)
if ( } catch (err) {}
lcpImage && if (urlStr === src || (url && url.pathname === src && !url.search)) {
!lcpImage.priority && warnOnce(
lcpImage.placeholder !== 'blur' && `Image with src "${src}" has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.` +
!lcpImage.src.startsWith('data:') && `\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader-width`
!lcpImage.src.startsWith('blob:') )
) { }
// https://web.dev/lcp/#measure-lcp-in-javascript }
warnOnce(
`Image with src "${lcpImage.src}" was detected as the Largest Contentful Paint (LCP). Please add the "priority" property if this image is above the fold.` + if (
`\nRead more: https://nextjs.org/docs/api-reference/next/image#priority` typeof window !== 'undefined' &&
) !perfObserver &&
} window.PerformanceObserver
) {
perfObserver = new PerformanceObserver((entryList) => {
for (const entry of entryList.getEntries()) {
// @ts-ignore - missing "LargestContentfulPaint" class with "element" prop
const imgSrc = entry?.element?.src || ''
const lcpImage = allImgs.get(imgSrc)
if (
lcpImage &&
!lcpImage.priority &&
lcpImage.placeholder !== 'blur' &&
!lcpImage.src.startsWith('data:') &&
!lcpImage.src.startsWith('blob:')
) {
// https://web.dev/lcp/#measure-lcp-in-javascript
warnOnce(
`Image with src "${lcpImage.src}" was detected as the Largest Contentful Paint (LCP). Please add the "priority" property if this image is above the fold.` +
`\nRead more: https://nextjs.org/docs/api-reference/next/image#priority`
)
} }
})
try {
perfObserver.observe({
type: 'largest-contentful-paint',
buffered: true,
})
} catch (err) {
// Log error but don't crash the app
console.error(err)
} }
})
try {
perfObserver.observe({
type: 'largest-contentful-paint',
buffered: true,
})
} catch (err) {
// Log error but don't crash the app
console.error(err)
} }
} }
} }
const imgStyle = Object.assign({}, style) const imgStyle = Object.assign(
fill
? {
position: 'absolute',
objectFit: 'contain',
height: '100%',
width: '100%',
}
: {},
style
)
const svgBlurPlaceholder = `url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 ${widthInt} ${heightInt}'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='50'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1 1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cimage filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='${blurDataURL}'/%3E%3C/svg%3E")` const svgBlurPlaceholder = `url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 ${widthInt} ${heightInt}'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='50'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1 1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cimage filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='${blurDataURL}'/%3E%3C/svg%3E")`
const blurStyle = const blurStyle =
placeholder === 'blur' && !blurComplete placeholder === 'blur' && !blurComplete
...@@ -576,6 +649,7 @@ export default function Image({ ...@@ -576,6 +649,7 @@ export default function Image({
blurStyle, blurStyle,
loading, loading,
config, config,
fill,
unoptimized, unoptimized,
placeholder, placeholder,
loader, loader,
...@@ -622,6 +696,7 @@ const ImageElement = ({ ...@@ -622,6 +696,7 @@ const ImageElement = ({
imgStyle, imgStyle,
blurStyle, blurStyle,
isLazy, isLazy,
fill,
placeholder, placeholder,
loading, loading,
srcString, srcString,
...@@ -644,7 +719,7 @@ const ImageElement = ({ ...@@ -644,7 +719,7 @@ const ImageElement = ({
width={widthInt} width={widthInt}
height={heightInt} height={heightInt}
decoding="async" decoding="async"
data-nimg="future" data-nimg={`future${fill ? '-fill' : ''}`}
className={className} className={className}
// @ts-ignore - TODO: upgrade to `@types/react@17` // @ts-ignore - TODO: upgrade to `@types/react@17`
loading={loading} loading={loading}
...@@ -707,7 +782,7 @@ const ImageElement = ({ ...@@ -707,7 +782,7 @@ const ImageElement = ({
width={widthInt} width={widthInt}
height={heightInt} height={heightInt}
decoding="async" decoding="async"
data-nimg="future" data-nimg={`future${fill ? '-fill' : ''}`}
style={imgStyle} style={imgStyle}
className={className} className={className}
// @ts-ignore - TODO: upgrade to `@types/react@17` // @ts-ignore - TODO: upgrade to `@types/react@17`
......
import React from 'react'
import Image from 'next/future/image'
const Page = () => {
return (
<div>
<h1>Fill Mode</h1>
<div
id="image-container-1"
style={{
height: '300px',
width: '300px',
position: 'relative',
overflow: 'hidden',
}}
>
<Image id="fill-image-1" src="/wide.png" fill />
</div>
<div id="image-container-2">
<Image id="fill-image-2" src="/wide.png" fill />
</div>
<div
id="image-container-3"
style={{
position: 'relative',
overflow: 'hidden',
}}
>
<Image id="fill-image-3" src="/wide.png" fill />
</div>
</div>
)
}
export default Page
import React from 'react'
import Image from 'next/future/image'
const Page = () => {
return (
<div>
<h1>Fill Mode</h1>
<div
id="image-container-1"
style={{
height: '300px',
width: '300px',
position: 'relative',
overflow: 'hidden',
}}
>
<Image id="fill-image-1" src="/wide.png" sizes="300px" fill />
</div>
</div>
)
}
export default Page
import React from 'react'
import Image from 'next/future/image'
const Page = () => {
return (
<div>
<h1>Fill Mode</h1>
<div
id="image-container-1"
style={{
height: '300px',
width: '300px',
position: 'relative',
overflow: 'hidden',
}}
>
<Image
id="fill-image-1"
src="/wide.png"
fill
style={{ position: 'relative' }}
/>
</div>
</div>
)
}
export default Page
import React from 'react'
import Image from 'next/future/image'
const Page = () => {
return (
<div>
<h1>Fill Mode</h1>
<div
id="image-container-1"
style={{
height: '300px',
width: '300px',
position: 'relative',
overflow: 'hidden',
}}
>
<Image
id="fill-image-1"
src="/wide.png"
width="500px"
height="400px"
fill
/>
</div>
</div>
)
}
export default Page
...@@ -677,6 +677,24 @@ function runTests(mode) { ...@@ -677,6 +677,24 @@ function runTests(mode) {
) )
}) })
it('should show error when width prop on fill image', async () => {
const browser = await webdriver(appPort, '/invalid-fill-width')
expect(await hasRedbox(browser)).toBe(true)
expect(await getRedboxHeader(browser)).toContain(
`Image with src "/wide.png" has both "width" and "fill" properties.`
)
})
it('should show error when CSS position changed on fill image', async () => {
const browser = await webdriver(appPort, '/invalid-fill-position')
expect(await hasRedbox(browser)).toBe(true)
expect(await getRedboxHeader(browser)).toContain(
`Image with src "/wide.png" has both "fill" and "style.position" properties. Images with "fill" always use position absolute - it cannot be modified.`
)
})
it('should show error when static import and placeholder=blur and blurDataUrl is missing', async () => { it('should show error when static import and placeholder=blur and blurDataUrl is missing', async () => {
const browser = await webdriver( const browser = await webdriver(
appPort, appPort,
...@@ -931,7 +949,62 @@ function runTests(mode) { ...@@ -931,7 +949,62 @@ function runTests(mode) {
await getComputedStyle(browser, 'img-blur', 'background-position') await getComputedStyle(browser, 'img-blur', 'background-position')
).toBe('1px 2px') ).toBe('1px 2px')
}) })
describe('Fill-mode tests', () => {
let browser
beforeAll(async () => {
browser = await webdriver(appPort, '/fill')
})
it('should include a data-attribute on fill images', async () => {
expect(
await browser.elementById('fill-image-1').getAttribute('data-nimg')
).toBe('future-fill')
})
it('should add position:absolute and object-fit to fill images', async () => {
expect(await getComputedStyle(browser, 'fill-image-1', 'position')).toBe(
'absolute'
)
expect(
await getComputedStyle(browser, 'fill-image-1', 'object-fit')
).toBe('contain')
})
it('should add 100% width and height to fill images', async () => {
expect(
await browser.eval(
`document.getElementById("fill-image-1").style.height`
)
).toBe('100%')
expect(
await browser.eval(
`document.getElementById("fill-image-1").style.width`
)
).toBe('100%')
})
if (mode === 'dev') {
it('should not log incorrect warnings', async () => {
await waitFor(1000)
const warnings = (await browser.log('browser'))
.map((log) => log.message)
.join('\n')
expect(warnings).not.toMatch(/Image with src (.*) has "fill"/gm)
})
it('should log warnings when using fill mode incorrectly', async () => {
browser = await webdriver(appPort, '/fill-warnings')
await waitFor(1000)
const warnings = (await browser.log('browser'))
.map((log) => log.message)
.join('\n')
expect(warnings).toContain(
'Image with src "/wide.png" has "fill" and parent element with invalid "position". Provided "static" should be one of absolute,fixed,relative.'
)
expect(warnings).toContain(
'Image with src "/wide.png" has "fill" and a height value of 0. This is likely because the parent element of the image has not been styled to have a set height.'
)
expect(warnings).toContain(
'Image with src "/wide.png" has "fill" but is missing "sizes" prop. Please add it to improve page performance. Read more:'
)
})
}
})
// Tests that use the `unsized` attribute: // Tests that use the `unsized` attribute:
if (mode !== 'dev') { if (mode !== 'dev') {
it('should correctly rotate image', async () => { it('should correctly rotate image', async () => {
......
...@@ -22,6 +22,11 @@ const Page = () => { ...@@ -22,6 +22,11 @@ const Page = () => {
width="500" width="500"
height="500" height="500"
/> />
<Image
id="fill-no-width-and-height"
src="https://image-optimization-test.vercel.app/test.jpg"
fill
/>
<Image <Image
id="quality-num" id="quality-num"
src="https://image-optimization-test.vercel.app/test.jpg" src="https://image-optimization-test.vercel.app/test.jpg"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment