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

[Question] How to render image with image picking from FilePicker() #269

Closed
hungpham3112 opened this issue Sep 18, 2023 · 1 comment
Closed

Comments

@hungpham3112
Copy link

Hi, I like the interactive features in PlutoUI.jl. I'm trying to render the image with FilePicker() but the data field is a vector so I don't know how to display the image.

How can I display image in this situation ?

@fonsp
Copy link
Member

fonsp commented Nov 21, 2023

Hey! Sorry for the late response, this will work:

# ╔═╡ d59d5f7c-887e-11ee-0fde-e1d5501026dd
using PlutoUI

# ╔═╡ 86b30519-56e1-483c-986d-f48508fb024b
@bind image_data FilePicker()

# ╔═╡ 51125f6a-48e2-4154-8d4a-271e808de083
image_data

# ╔═╡ 5f039984-2e73-40a4-9101-1c4ae16788c7
begin
	path = tempname() * image_data["name"]
	write(path, image_data["data"])
end

# ╔═╡ 1883ebae-9086-47ac-9dca-534010fc7885
LocalResource(path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants