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

Avif with jpeg fallback #451

Closed
kasperkamperman opened this issue Oct 11, 2023 · 4 comments
Closed

Avif with jpeg fallback #451

kasperkamperman opened this issue Oct 11, 2023 · 4 comments

Comments

@kasperkamperman
Copy link

Important.
Is see Avif extensions are supported (based on other closed issue)

Please describe the feature you want to be implemented.
It think it's needed to offer a fallback to jpeg when using avif, jpegxl or webp.
I reviewed several lightbox solutions and no-one seems to offer this.

Explain why the feature is useful
Newer browsers use AVIF, so images load faster, less bandwidth is used for the same quality.
Older browsers fallback to JPEG.

Have you seen it somewhere else?
I use this now for my thumbnails, a combination of img srcset (for responsive loading) and source srcset, wrapped in the picture tag.

<picture>
     <source srcset="photo_1600.avif 1600w, photo_800.avif 800w" sizes="100vw" type="image/avif" >
     <img src="photo_800.jpg" srcset="photo_1600.jpg 1600w, photo_800.jpg 800w" sizes="100vw" alt="Description of the image">
</picture>

Additional context
If there is already some workaround (I , I'd like to know, however I couldn't find it in the documentation.

@gingerchew
Copy link
Collaborator

Related Issue: #361

Going to close this.

@tykling
Copy link

tykling commented Nov 21, 2024

Apologies in advance for responding to a closed issue, but I think this issue should not have been closed:

#361 is about responsive loading of images, in other words: let the browser pick the best size
#451 (this issue) is about offering multiple <source> formats in the <picture> tag, in other words: let the browser pick the best filetype

These are related but not the same. I can't currently find a way to use, say, webp and fallback to png with glightbox, because there is no way to specify multiple formats.

Thanks! :)

@gingerchew
Copy link
Collaborator

gingerchew commented Nov 21, 2024

@tykling Thats true, you can't do file format fallback with the <img> tag. That's a feature of the <picture>. Hence why it was a related issue, even though it isn't explicitly referencing file format fallback.

The idea in 361 is to add a "sources" property that would work with file formats or size or whatever.

@tykling
Copy link

tykling commented Nov 21, 2024

I see, ok thank you. Looking forward to it! 👍

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