go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.87k stars 5.47k forks source link

[Feature Request] next gen image previews #16629

Open G2G2G2G opened 3 years ago

G2G2G2G commented 3 years ago

I don't see any mention of them so throwing it out there since browser support is coming faster than any other formats that ever existed. When you view a jxl or avif it currently says: Binary file not shown. For now a setting in the app.ini file would make sense I guess to allow them to be previews for whoever has it enabled.

All major browsers can now be enabled / already ship with it enabled. Jpeg XL thumbs (.jxl) Mime type: image/jxl https://caniuse.com/jpegxl

AVIF (AV1's image from the Alliance for Open Media)
Mime type: image/avif https://caniuse.com/avif

noerw commented 3 years ago

This probably won't be fixed in upstream dependencies as we use a patched version of https://pkg.go.dev/net/http#DetectContentType, which only implements an unmaintained spec.

Scratch that, it should be supported in upcoming go 1.17

Scratch that too, this detection is based on file extension, which we currently ignore.

Here's some go code that (incorrectly) adds avif support: https://github.com/gabriel-vasile/mimetype/pull/160 Maybe we could just use that lib

G2G2G2G commented 3 years ago

You're opening each file to read it's type for how you treat in the browser?

animated.avif: ISO Media, AVIF Image Sequence

still.avif: ISO Media, AVIF Image

KN4CK3R commented 2 years ago

AVIF support was added in https://github.com/gabriel-vasile/mimetype/pull/210