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

Ability to use ui.image, ui.avatar with local images #1040

Open
mofojed opened this issue Nov 25, 2024 · 1 comment
Open

Ability to use ui.image, ui.avatar with local images #1040

mofojed opened this issue Nov 25, 2024 · 1 comment
Labels
enhancement New feature or request triage

Comments

@mofojed
Copy link
Member

mofojed commented Nov 25, 2024

Currently you can only serve up an image that is publicly accessible, e.g. i = ui.image("https://github.com/deephaven.png"). If you try and serve up a local image to the container, you'll just get an error because the path will not be local to the client.
We should be able to use a local image.
E.g. you should be able to specify: i = ui.image('./plugins/ui/docs/_assets/text_filter_table.png') and it should just magically work.

Note there is a workaround currently by base64 encoding the image:

import base64
from deephaven import ui

with open("./plugins/ui/docs/_assets/text_filter_table.png", 'rb') as f:
    file_content = f.read()
    
b64_image = ui.image(f"data:image/png;base64,{base64.b64encode(file_content).decode()}")
@mofojed mofojed added enhancement New feature or request triage labels Nov 25, 2024
@dsmmcken
Copy link
Contributor

dsmmcken commented Nov 25, 2024

I would try to generalize this as much as possible.

Like imagine someone doing .write_csv("./path/to/file") and the using a ui.link("Download file", href="./path/to/file", download=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage
Projects
None yet
Development

No branches or pull requests

2 participants