Woohoo. Thanks!


On Monday, May 26, 2014 5:03:25 PM UTC-4, Steven G. Johnson wrote:
>
> The text/plain hack you implemented is definitely wrong, and will cause 
> problems if the writemime function is used in any other context.
>
> You need to decide what MIME type the vector of images will be.   The most 
> natural choices would be either HTML (
> http://stackoverflow.com/questions/2807251/can-i-embed-a-png-image-into-an-html-page)
>  
> or SVG (
> http://stackoverflow.com/questions/6249664/does-svg-support-embedding-of-bitmap-images),
>  
> both of which support embedding PNG data.
>
> e.g. for HTML, you could do something like the following (untested, may 
> have typos):
>
> function Base.writemime(io::IO, ::MIME"text/html", x::AbstractVector{Png})
>     print(io, "<p>", length(x), "-element ", typeof(x), "<ul>)
>     png = MIME("image/png")
>     for i in x
>         print(io, "<li><img src=\"data:image/png;base64,", 
> base64(writemime, png, i), "\" /></li>")
>     end
>     print(io, "</ul>")
> end
>
>

Reply via email to