-
Notifications
You must be signed in to change notification settings - Fork 35
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
Astro transformer format #110
Comments
@ascorbic do you have any suggestions for where the url parameter isn’t getting passed correctly in https://github.com/ascorbic/unpic/blob/main/src/transformers/astro.ts ? |
Is it adding the param to the URL? Have you tried manually opening the image and changing the param? Are you able to get it to generate the right format? |
I have confirmed that the Astro Setting the format on the image component fails when trying to add the param to the URL <UnpicAstroImage
src="/static/assets/images/owl.jpg?f=webp"
cdn="astro"
layout="constrained"
width={1023}
height={682}
/> Whereas setting the format using picture and source components works <picture>
<UnpicAstroSource
type="image/avif"
src="/static/assets/images/owl.jpg"
cdn="astro"
width={1023}
height={682}
/>
<UnpicAstroSource
type="image/webp"
src="/static/assets/images/owl.jpg"
cdn="astro"
width={1023}
height={682}
/>
<UnpicAstroSource
src="/static/assets/images/owl.jpg"
cdn="astro"
width={1023}
height={682}
/>
<UnpicAstroImage
src="/static/assets/images/owl.jpg"
cdn="astro"
layout="constrained"
width={1023}
height={682}
/>
</picture> P.S. EDIT: I can confirm that |
What you can do is pass in one of the generated endpoint URLs. That shoudl let you set the format, and it should also detect it as Astro |
Passing in one of the generated endpoint urls didn‘t work, since the passed url ended up in the href url parameter |
I may be misunderstanding how the transformers or Astro components work, but I’m not sure how to set
webp
as the format. The url paramf=webp
doesn’t work, and I can’t seem to get the<Source />
component to work either (maybe I’m settingtype="image/webp"
incorrectly?). Anyway, tips to get thewebp
format working are much appreciated.The
<Image />
component works great otherwise (once the typing is fixed)The text was updated successfully, but these errors were encountered: