webui-dev / webui

Use any web browser or WebView as GUI, with your preferred language in the backend and HTML5 in the frontend, all in a lightweight portable lib.
https://webui.me
MIT License
2.36k stars 144 forks source link

Can the webui_set_file_handler serve the image files or other type? #355

Closed heimo88 closed 1 month ago

heimo88 commented 2 months ago

I found that the webui_set_file_handler only return the strings, can I return a byte[] or stream for the images or other file like mp3 mp4 etc. ?

heimo88 commented 2 months ago

By the way, your project is excellent. tks!

AlbertShown commented 2 months ago

Yes, if you are using C/C++ webui_set_file_handler is const void *, which mean you can return any raw binary data, just be sure to set the size of your binary data.

If you are using a wrapper (Other than C/C++) then you should re-open issue in the wrapper's repo to make sure the wrapper also support binary.

heimo88 commented 1 month ago

Great, you're right. I'm using Lazarus, and in its wrapper, it uses Pansichar. I changed it to Pointer, and it worked. Thanks again.