-
Notifications
You must be signed in to change notification settings - Fork 23
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
Specifying both width
and height
incorrectly applies rect
#32
Comments
Due to sanity-io/image-url#32, setting a `height` prop will cause unexpected behavior.
Since the API is modeled after imgix's API, I believe |
Sharing this here as it solved the problem for me: In summary, try adding
|
This library incorrectly sets the
rect
parameter when bothwidth
andheight
are specified. This prevents manyfit
modes from working properly. An in-depth visual comparison and breakdown of this bug is available in this CodeSandbox project. At a glance, this screenshot from the linked breakdown demonstrates the issue:I considered stripping the
rect
prop from the returned urls, but it still needs to be present in two scenarios:The rationale here should be self-evident:
rect
is used to apply crop values.fit
mode ismin
and the source has a focal pointThis library transforms
hotspot
values into focal point parametersfp-x
andfp-y
, but due to a bug/oversight in the Images API, these parameters are only used when thefit
mode is set tocrop
. Since themin
mode is identical tocrop
except that the image will not be scaled up, the focal point needs to be emulated viarect
(or the bug in the Images API needs to be fixed)I believe this library should only add a
rect
parameter in these two scenarios, and to try to pre-compute and apply the focal point in the second case.The text was updated successfully, but these errors were encountered: