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

Add position prop to support all Builder params #128

Open
thomkrupa opened this issue Apr 18, 2024 · 1 comment
Open

Add position prop to support all Builder params #128

thomkrupa opened this issue Apr 18, 2024 · 1 comment

Comments

@thomkrupa
Copy link

Hey,

First of all, fantastic work on the unpic library.

I would love to have option to set position param, it's especially useful for setting better crop.

https://www.builder.io/c/docs/image-api

Thanks!

@thomkrupa
Copy link
Author

Can you support more params? We deliberately just support the most common params that are shared between all CDNs. If you need more params then you can use the CDN-specific API directly.

I think position/crop is a pretty important prop, but I think is ok not to add it as official prop to keep the base simple.

@ascorbic what about a good way to extend props/add customs for transformers? Currently it's not that obvious. Something like:

const url = transformUrl(
  {
    URL: "...",
    width: 800,
    height: 600,
    cdn: "builder",
    customSearchParams: {
       position: "left top"
    }
  },
);

Right now, I pass those custom params to the URL, like this:

<Image src={imageSrc + "?position=left%20top"} />

It works. I know I can build a custom component for this, but it would be cool if the official component could look like this:

<Image
  src={imageSrc}
  customSearchParams={{
    position: "left top"
  }}
/>

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

1 participant