-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image placeholder does not respect objectFit property #30033
Comments
I had that issue too once |
Seems like other styles are not applied either such as |
This should be fixed once we land #34339 and the |
Also experiencing that issue. Even if "raw" eventually solves a particular use case, it still means that blur area will fit the entire parent width/height when using |
Experiencing this too and found that applying an aspect ratio to the image's parent helps, something like:
|
Looks to have been resolved in #26590 |
Closing because of the suggestion above. If you still think it's an issue, please open a new one with a fresh reproduction (using |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
11.1.0
What version of Node.js are you using?
14.17.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
next start
Describe the Bug
When I use the
Image
component to render an image withlayout=fill
andobjectFit=contain
property, it does it well when the image has been loaded (image is adapting into parent container), but when I setplaceholder=blur
I see blurred image filling the whole container instead of being contained (image ratio is same as original)Expected Behavior
I'm expecting to see
objectFit
andobjectPosition
props toblurDataURL
image as wellTo Reproduce
Here is the code sample:
<Image src="https://assets.imgix.net/setup/serving-swimmer.jpg?w=7000" alt="Image test" layout="fill" objectFit="contain" objectPosition="center" placeholder="blur" blurDataURL="https://assets.imgix.net/setup/serving-swimmer.jpg?w=10" />
You can find a sandbox running sample here. If your connection is too good, please increase the
w=7000
value in src to increase the image sizehttps://codesandbox.io/s/image-placeholder-object-fit-contain-70h5q?file=/pages/index.js
The text was updated successfully, but these errors were encountered: