Skip to content

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

@mofojed

Description

@mofojed

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()}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions