Re: displaying binary images



It is a base64 byte array of the format of a png file. If I write the array to
disk as a png file with that extension, it opens fine in the browser. The
problem is that I do not want to have to save it directly to a disk. I want to
just display it directly to the browser.


In article <1136319064.181782.27910@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
bwucke@xxxxxxxxx says...
>
>
>mleaver@xxxxxxx napisal(a):
>> windowHandle.document.write('<img name="myImage" src="javascript:png">');
>>
>> where png is the variable that contains a base64 binary array representation
>
>Array? well, you need a base64 string. I'm not sure what format your
>array is, but I bet changing it into a string shouldn't be too hard.
>
>> of
>> the png file that was returned from the server.
>>
>> What is the correct way to display a base64 image directly?
>
><img
>src="data:image/png;base64,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";>
>
>where "XXXXXXXXXXXXXXXX" is the base64-encoded image content.
>Of course it will fail in MSIE if the data: URL is longer than 256
>chars (and for anything bigger than a few pixels, it will), so better
>look for alternate solutions for it (probably there is some ActiveX
>control that can do it - Not a 'correct' way but a working one :)
>

.



Relevant Pages

  • Re: How to verify specified signature in .NET using RSA
    ... why are you converting the signed token provided as Base64 into a byte array and then back into a string and then back into a byte array again instead of converting it directly to a byte array as I suggested? ... It seems less likely to be the right way to this since the signature data is probably arbitrary binary data which would encode properly as Base64 but might not have a valid string representation in ASCII since ASCII allows a much reduced set of characters and will not deal well with unprintable values and nulls. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Encrypted email - is there a specific solution?
    ... assign the byte array to the mailmsg body please? ... >, then you can encrypt ... > the data and either send it to yourself as an attachment or base64 encode it ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Base64 strange problem
    ... base64 decoder in the servlet to decode it. ... the decoded byte array is shorter then the original one. ...
    (comp.lang.javascript)
  • Re: xml serialization of List
    ... If you want an array of bytes serialized as Base64, use an array, not a ... The devil is in the yada yada yada ...
    (microsoft.public.dotnet.framework)
  • embedding binary data in a class
    ... I'm trying to embed some binary data (a PNG file) in a java class. ... doing this using a byte array member that is initialized with the data. ... I'm now looking at storing the data in a String, ...
    (comp.lang.java.help)