SimonDanisch / Bonito.jl

Serving JS to the browser
MIT License
204 stars 29 forks source link

fix attributes with binary asset (e.g. DOM.img) #211

Closed SimonDanisch closed 8 months ago

SimonDanisch commented 8 months ago

fixes:

function img2binary(img)
    io = IOBuffer()
    show(io, MIME"image/png"(), img)
    return Bonito.BinaryAsset(take!(io), "image/png")
end

App() do app
    img_array = FileIO.load("...")
    DOM.img(src=img2binary(img_array))
end