[Midas] handling images via web api

Zach Mullen zach.mullen at kitware.com
Mon Jul 2 18:47:47 EDT 2012


If you want to render the image in the browser, use
midas.bitstream.download.  It will send the correct MIME Type header and
then stream the raw bytes to the client.  Example:

<img id="theImage" src="" />

$('#theImage').attr('src', '
http://midas/api/rest?method=midas.bitstream.download...');

Thanks,

Zach

On Mon, Jul 2, 2012 at 6:41 PM, Mona Wong <mona at sdsc.edu> wrote:

>
> Hi:
>
> I need to retrieve a PNG image file from Midas to my javascript client
> app.  I'm not sure what's the best way to do this.
>
> Currently, I'm trying via the web API midas.get.download however since the
> data retrieved is binary, I think I need to do a Base64 encoding before
> being able to get the data from the request's responseText.  Can this be
> done via the web API or do I need to write my own method?
>
> Also, I see midas.bitstream.download, how is that different from
> midas.item.download?
>
> thanks,
> Mona
>
>
>      *********************************************
>     Mona Wong
>     Web & iPad Application Developer
>     San Diego Supercomputer Center
>
>     Believing we are in control is an
>     illusion that brings suffering.
> *********************************************
>
>
>
>
>
>
> _______________________________________________
> Midas mailing list
> Midas at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/midas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/midas/attachments/20120702/91617649/attachment.html>


More information about the Midas mailing list