BurntNail / vent

Website for managing House Events
https://blog.maguire.tech/posts/projects/vent/
MIT License
4 stars 1 forks source link

HEIC Support #183

Open HandyHat opened 1 year ago

HandyHat commented 1 year ago

Is your feature request related to a problem? Please describe. I'm trying to upload HEIC photos but there is no support

Describe the solution you'd like Ability to upload HEIC photos

Describe alternatives you've considered I could convert the photos to a supported format on my end. Alternatively, limited support could be added for unsupported files too, akin to a file storage solution

Additional context image

BurntNail commented 1 year ago

Firstly - this shouldn't be a 404, this should be a malformed request. I'm not even sure how you managed to try to upload the HEIC because it shouldn't let you - I explicitly set the allowed upload types for HTML forms ( image ) - image/bmp, image/exr, image/gif, image/hdr, image/ico, image/jpeg, image/png, image/qoi, image/tiff, image/webp. EDIT: just saw the all files option smh thats cheating.

Chances of this actually making it are low (but if I get bored on a Friday evening then you never know ;) ) - this is due to a lack in support from both my image library as well as most browsers (go safari i guess).

This would mean that I have to use something like libheif-rs to read in the image from the bytes, re-encode it as a more normal format like a png or a jpeg using the image library and a generic ImageBuffer, and its save function.

I'm not a fan of the look of libheif-rs because I'd have to faff around with more system-based non-pure-rust dependencies (specifically libheif-dev >= 1.16.0), which are fine on linux (where in fairness, this'll be going to be deployed) but can be painful to manage on windows.

BurntNail commented 1 year ago

Ubuntu package Windows package via vcpkg

Instructions from libheif for windows:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
./vcpkg integrate install
./vcpkg install libheif
BurntNail commented 1 year ago

I've had a look at the library, and I can't get it to work. Whilst I don't doubt that I wouldn't struggle on Linux, my current main development environment is Windows and so I'm closing this issue now. If you want to submit a PR, go ahead but it must include clear repeatable instructions for development on Windows 11.

HandyHat commented 1 year ago

Thank you so much for looking into this so promptly!

EDIT: just saw the all files option smh thats cheating.

Where's the fun in not cheating??

(go safari i guess).

Lol I didn't realise how poorly supported HEIF was.

Thoughts on allowing HEIF upload just as a file without support for displaying the images @BurntNail ? Would be better than not having the images at all imo

BurntNail commented 1 year ago

If there's a MIME type so I can still restrict uploads (assuming goodwill, thanks for reminding me to add functionality to check uploaded materials), then yes if not then no.

I'll also add some thing to make it clearer that these images won't be displayed.

I don't have time for it right now though - might not be possible until December :(

HandyHat commented 1 year ago

No worries!

BurntNail commented 1 month ago

I'm now on linux and so will consider this.