Re: displaying binary images




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: displaying binary images
    ... It is a base64 byte array of the format of a png file. ... disk as a png file with that extension, it opens fine in the browser. ...
    (comp.lang.javascript)
  • Re: SHA1 digest
    ... The hex and base64 versions can present slight problems ... > The reference to character padding is something I don't understand at all. ... binary data sample to the same, unique Base64 string. ... These aren't big issues (as you already pointed out with the hex ...
    (comp.lang.perl.modules)
  • 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)