Question about Unexpected behavior #48
Unanswered
eric-mathison
asked this question in
Q&A
Replies: 1 comment 4 replies
-
You are correct, should be the other way around, height should be divided by width and w/h. Workaround is to supply your own aspect ratio viaplaceholderAspectRatio parameter. You probably should submit a bug report in the issues, instead of the discussion topic.
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey Josh and community.
I'm trying to implement this in a project that I have going and am seeing somewhat of unexpected behavior with the placeholder and the image chosen / loaded. I've looked over everything multiple times and cannot find what I'm missing here.
A quick note, I'm using everything from the tutorial (api route, disk cache, etc) with exception of the responsive sizes.
As far as the component, this is what I'm using:
The resulting html is:
Looking at the server logs:
At full resolution, the placeholder/image is set to
style="min-width: 768px; min-height: 1152px;
making the image really distorted. I've identified the culprit to be thecomputePlaceholderSize
function. Wheredoes equal the 768x1152. In my instance if the operation was
Math.round(largestWidth / ratio)
, the result would be the proper 512px.Second, the placeholder and the image loaded doesn't seem to change when the screen width does. Inspecting in chrome and using the responsive viewer, the image that is loaded is always the largest image (regardless of the viewport settings). For instance using a 320px view, the image / placeholder is still width: 768px height: 1152px.
Any help here as to what I'm missing or can be done to fix this is greatly appreciated. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions