constructing an Image from a byte array

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

constructing an Image from a byte array

johnd
I am making a file tree viewer.  I have a jsonrpc function that takes
a path and returns back a base64 encoded byte array.  I want to make
an image, but the Image constructor only works on URL's.

I don't want the image to be published on a web server, but rather
protected by a rpc call that will check to make sure the user has the
right permission to see it.

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: constructing an Image from a byte array

Derrell Lipman
On Tue, Aug 23, 2011 at 18:02, John de la Garza <[hidden email]> wrote:
I am making a file tree viewer.  I have a jsonrpc function that takes
a path and returns back a base64 encoded byte array.  I want to make
an image, but the Image constructor only works on URL's.

I don't want the image to be published on a web server, but rather
protected by a rpc call that will check to make sure the user has the
right permission to see it.

Since you're already base64-encoding your image, you're most of the way to a "Data URI" for an image, which is accepted by the Image constructor. See http://en.wikipedia.org/wiki/Data_URI_scheme for details.

Cheers,

Derrell


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: constructing an Image from a byte array

johnd
On Tue, Aug 23, 2011 at 5:44 PM, Derrell Lipman
<[hidden email]> wrote:

>
> Since you're already base64-encoding your image, you're most of the way to a
> "Data URI" for an image, which is accepted by the Image constructor. See
> http://en.wikipedia.org/wiki/Data_URI_scheme for details.
>
I read about data URI in the docs and thought it was a undocumented
qooxdoo thing.  This is exactly what I needed.

Thanks

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel