Skip to content

Change file extension when converting format #54

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

Closed
Razunter opened this issue Nov 26, 2021 · 8 comments · May be fixed by #259
Closed

Change file extension when converting format #54

Razunter opened this issue Nov 26, 2021 · 8 comments · May be fixed by #259

Comments

@Razunter
Copy link

Currently, file extension stays the same on conversion to a different format. This is a bad behavior and should be fixed.

@pi0
Copy link
Member

pi0 commented Nov 26, 2021

Hi @Razunter. What do you mean by file extension? I believe handler sends the right meme and we are not sending any other header about file name or extension.

@Razunter
Copy link
Author

Hm… I've meant generation urls always end in the original file extension, and it causes confusion: avif-wepb etc. still end up with urls looking like they are wrong extension. Like in the docs: http://localhost:3000/embed,f_webp,s_200x200/static/buffalo.png. It's webp, but it looks like png since url ends with png.

@pi0
Copy link
Member

pi0 commented Jun 20, 2022

I can understand DX issues but we cannot change the last part as it has to directly map to the source id. Without the extension, we don't know what is an original file path. I'm closing this issue as cannot think of an easy possible solution but please ping to reopen if you have an idea without changing signature and dropping source extension.

@toto6038
Copy link

toto6038 commented May 2, 2024

Though it may not be a clever solution, how about appending the converted file extension so that we can keep both the mapping relation while still having the browser to pick up the right file extension.

Example:
Original file @/static/buffalo.png becomes /f_webp/static/buffalo.png.webp

@Mateleo
Copy link

Mateleo commented Feb 1, 2025

I spent an hour trying to figure out why my images were always in .png format.
I saw @toto6038 's comment and understood. After checking with ffprobe, it was webp all along...

@sgarner
Copy link

sgarner commented Mar 31, 2025

This is not just a DX issue. It makes ipx and nuxt/image unusable for static site deployments, where the middleware isn't in play. Because the generated files have the wrong file extension they also end up being served with the wrong MIME type.

@Predota
Copy link

Predota commented Apr 22, 2025

Hi everyone,
While waiting for the option to customize URL parsing, is there a known workaround for static site deployments ?

@ziadsarour
Copy link

This is not just a DX issue. It makes ipx and nuxt/image unusable for static site deployments, where the middleware isn't in play. Because the generated files have the wrong file extension they also end up being served with the wrong MIME type.

Same here, Lighthouse think I'm using jpeg images and is lowering my score

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

Successfully merging a pull request may close this issue.

7 participants