Hello, I am new to dash and was wondering if it is possible to have my app serve Images to my webpage from information selected in the dropdown menu.
so far I have a dropdown menu that updates information in a data table when something is selected from the dropdown but I also want to then have an image uploaded to my page that corresponds with the dropdown.
is this possible and how would I go about this with callbacks etc?
Thanks
Hi @Pricey98 and welcome to the Community.
Yes it’s possible.
You have to include an html.Img component in the layout.
html.Img(id = “my_image”, src=app.get_asset_url("image.jpg")
All the image files must be located in the /assets folder when the app starts running.
Then in the callback use the dropdown value as input and the following Output:
Output(“my_image”, “src”),
And return the source with the corresponding image file.
1 Like
Thanks @Eduardo! would I have to do this for each different image I want to show for each dropdown value?
Yes, you need to have a dictionary with each option of the dropdown and each image file
1 Like
Great! Thank you for the help
1 Like