[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

How to load binary image with Javascript with NO BASE64 conversion

Richard Maher

7/27/2014 2:24:00 AM

Hi,

Can someone please provide an example of loading a binary image file
that is being streamed from a server and accessed via an AJAX call?

I've been googleing for ages and can't find anything without btoa() and
base64 encoding :-(

Can I just use data URIs and application/octet-stream or + uint8array or
some other?

Cheers Richard
18 Answers

Evertjan.

7/27/2014 7:45:00 AM

0

Richard Maher <maher_rjSPAMLESS@hotmail.com> wrote on 27 jul 2014 in
comp.lang.javascript:

> Can someone please provide an example of loading a binary image file

All image files are binary, surly?

> that is being streamed from a server

in essense only the stream is sent, not the file.

> and accessed via an AJAX call?

Do you mean commanded to be sent?

> I've been googleing for ages and can't find anything without btoa() and
> base64 encoding :-(
>
> Can I just use data URIs and application/octet-stream or + uint8array or
> some other?

Do you mean serverside Javascript code example?

What do you mean by "loading" in this case? Not displaying?

What do you mean by streaming? Everything that is sent from server to client
browser is streaming, like the greeks said: 'panta rei, kai ouden menei'?

What is btoa(), surely not native JS?

What advantage is the use of AJAX here?

Methinks you cannot find the answer, because the Q is not exact.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Richard Maher

7/27/2014 9:03:00 AM

0

On 7/27/2014 3:44 PM, Evertjan. wrote:
> Richard Maher <maher_rjSPAMLESS@hotmail.com> wrote on 27 jul 2014 in
> comp.lang.javascript:
>
>> Can someone please provide an example of loading a binary image file
>
> All image files are binary, surly?
>
>> that is being streamed from a server
>
> in essense only the stream is sent, not the file.
>
>> and accessed via an AJAX call?
>
> Do you mean commanded to be sent?
>
>> I've been googleing for ages and can't find anything without btoa() and
>> base64 encoding :-(
>>
>> Can I just use data URIs and application/octet-stream or + uint8array or
>> some other?
>
> Do you mean serverside Javascript code example?
>
> What do you mean by "loading" in this case? Not displaying?
>
> What do you mean by streaming? Everything that is sent from server to client
> browser is streaming, like the greeks said: 'panta rei, kai ouden menei'?
>
> What is btoa(), surely not native JS?
>
> What advantage is the use of AJAX here?
>
> Methinks you cannot find the answer, because the Q is not exact.
>

Right, you, pointed ears and the rest of your merry bunch of personality
disorders can just fuck off!

Actually why don't you go and protect that plane wreck and hang around a
bit longer than you compatriots did in Srebrenica. I sure the rebels
will enjoy the scintillating repartee from pointless pricks like you.

Denis McMahon

7/27/2014 11:07:00 AM

0

On Sun, 27 Jul 2014 10:23:55 +0800, Richard Maher wrote:

> Can someone please provide an example of loading a binary image file
> that is being streamed from a server and accessed via an AJAX call?

See https://developer.mozilla.org/en/docs/Web/API/XMLH... and
associated material.

--
Denis McMahon, denismfmcmahon@gmail.com

Thomas 'PointedEars' Lahn

7/27/2014 12:35:00 PM

0

</killfile>

Richard Maher wrote:

> On 7/27/2014 3:44 PM, Evertjan. wrote:
>> Methinks you cannot find the answer, because the Q is not exact.
>
> Right, you, pointed ears and the rest of your merry bunch of personality
> disorders can just fuck off!
>
> Actually why don't you go and protect that plane wreck and hang around a
> bit longer than you compatriots did in Srebrenica. I sure the rebels
> will enjoy the scintillating repartee from pointless pricks like you.

These reactions, ongoing address munging, and using a troll server,
will surely get you the answers that you seek.

<killfile>

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Michael Haufe (\"TNO\")

7/27/2014 5:47:00 PM

0

On Saturday, July 26, 2014 9:23:55 PM UTC-5, Richard Maher wrote:

> Can someone please provide an example of loading a binary image file
> that is being streamed from a server and accessed via an AJAX call?
>
> I've been googleing for ages and can't find anything without btoa() and
> base64 encoding :-(
>
> Can I just use data URIs and application/octet-stream or + uint8array or
> some other?

Why can't you simply:

var foo = new Image()
foo.onload = ...
foo.src = imgSrc;

Is this image not stored as an image on the server?

Evertjan.

7/27/2014 5:57:00 PM

0

"Michael Haufe (TNO)" <tno@thenewobjective.com> wrote on 27 jul 2014 in
comp.lang.javascript:

> Is this image not stored as an image on the server?

How would a image be stored on a server as an image,
or not as an image?

A server does not mind how the client infers the data to be.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Michael Haufe (\"TNO\")

7/27/2014 7:26:00 PM

0

On Sunday, July 27, 2014 12:57:04 PM UTC-5, Evertjan. wrote:

> How would a image be stored on a server as an image,
> or not as an image?

I'm referring to the difference between representation and interpretation of data referred to as "image". For example, if an "image" is stored in a file called foo.txt, or foo.dat as base64, the intent may be for that to be an image but this is not clear based on simply looking at that file. If a client then requests that file, it would be unsurprising if the server responds with a type of text/plan instead of image/png.

> A server does not mind how the client infers the data to be.

The server has no need to care how the data is interpreted, but the client may care about the response type.

The point of the question to the OP is to obtain more information on how this resource is being served to the client.

Michael Haufe (\"TNO\")

7/27/2014 7:32:00 PM

0

On Sunday, July 27, 2014 2:25:34 PM UTC-5, Michael Haufe (TNO) wrote:

> [...] it would be unsurprising if the server responds with a type of text/plan instead of image/png.

"text/plain" of course

Evertjan.

7/27/2014 7:58:00 PM

0

"Michael Haufe (TNO)" <tno@thenewobjective.com> wrote on 27 jul 2014 in
comp.lang.javascript:

> The point of the question to the OP is to obtain more information on how
> this resource is being served to the client.

Okay.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Eli the Bearded

7/28/2014 5:54:00 AM

0

In comp.lang.javascript, Evertjan. <exxjxw.hannivoort@inter.nl.net> wrote:
> Richard Maher <maher_rjSPAMLESS@hotmail.com> wrote on 27 jul 2014 in
> comp.lang.javascript:
> > Can someone please provide an example of loading a binary image file
> All image files are binary, surly?

Not in the slightest. Postscript (eg Adobe Illustrator files) is, like
the proposed scenario, usually just text, but sometimes has ASCII-fied
binary or compressed text portions. Postscript usually uses base85
encoding, though. SVG is XML. Have you heard of "typewriter art"? It was
later reborn as "ASCII art" when computers became popular. Many older
Unix image formats are text based. Xfig saves as text. The xpm files are
syntactically pure C code.

> Methinks you cannot find the answer, because the Q is not exact.

With computers, stating the problem correctly is often 90% to seeing the
solution. (And the 10% of the time its finding out the problem cannot be
solved.)

Elijah
------
see, eg, the halting problem