mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
3bf570d84d
Closes: - https://linear.app/vercel/issue/DOC-4626/images - https://linear.app/vercel/issue/DOC-4610/split-image-and-font-pages Redirects: https://github.com/vercel/next.js/pull/78769 **Housekeeping:** - Deletes BYA images page - Creates relevant getting started docs in `/pages` - Splits "Images and Fonts" into "Images" and "Fonts" pages to allow us to add more context to each page in the future **API reference**: - Improves image API reference to follow more of a consistent format and language - Adds examples **Follow-up:** https://github.com/vercel/next.js/pull/78857 - Create a Deep Dive Guide on how image optimization works --------- Co-authored-by: Rich Haines <hello@richardhaines.dev>
20 lines
1.1 KiB
Plaintext
20 lines
1.1 KiB
Plaintext
---
|
|
title: 'Missing `width` in the URL Returned by the Loader Prop on `next/image`'
|
|
---
|
|
|
|
## Why This Error Occurred
|
|
|
|
The [`loader`](/docs/pages/api-reference/components/image#loader) prop on the `next/image` component allows you to override the built-in URL resolution with a custom implementation in order to support any 3rd party cloud provider that can perform Image Optimization.
|
|
|
|
This error occurred because the provided `loader()` function did not use `width` in the returned URL string. This means that the image will likely not be resized and therefore degrade performance.
|
|
|
|
## Possible Ways to Fix It
|
|
|
|
- Ensure your Image Optimization provider can resize images. Then use the `width` parameter from the [`loader()`](/docs/pages/api-reference/components/image#loader) function to construct the correct URL string.
|
|
- Add the [`unoptimized`](/docs/pages/api-reference/components/image#unoptimized) prop.
|
|
|
|
## Useful Links
|
|
|
|
- [Image Optimization Documentation](/docs/pages/api-reference/components/image)
|
|
- [`next/image` Documentation](/docs/pages/api-reference/components/image)
|