Skip to content
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

It includes faulty rect parameter #58

Open
lejtzen opened this issue May 16, 2023 · 2 comments
Open

It includes faulty rect parameter #58

lejtzen opened this issue May 16, 2023 · 2 comments

Comments

@lejtzen
Copy link

lejtzen commented May 16, 2023

Why does the imageUrlBuilder add the faulty rect parameter to the url?

Example

import createImageUrlBuilder from '@sanity/image-url'

const imageUrlBuilder = createImageUrlBuilder({ projectId, dataset })
const url = imageUrlBuilder.image(source).width(300).height(50).fit('clip').url()

console.log(url)

url outputs https://cdn.sanity.io/images/XXXXXXXX/XXX/filename.png?rect=0,75,1200,200&w=300&h=50&fit=clip. I expected it to be https://cdn.sanity.io/images/XXXXXXXX/XXX/filename.png?w=300&h=50&fit=clip.

This must be a bug? Is there any other way to get the image url and an image constrained within the given width and height without cropping or distorting the image?

@sodevious
Copy link

Also having this issue on 1.0.2.

@Michael-1
Copy link

Duplicate of #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants