PDA

View Full Version : Streaming images


rajs1
10-25-2004, 01:46 PM
I need to display gif images (blob) stored in a database to a Laszlo client.

Is this possible, are there any examples I can refer to.

Thanks en avance.

amelard
10-27-2004, 07:24 AM
You could build the image before using it in Laszlo, for exemple, in the java class that carry out the database access...

rajs1
10-27-2004, 01:52 PM
First, thanks for the reply, but I do not understand.

Almost all examples I have seen in Laszlo displays the image from a file on disk.

For a servlet I would just

response.setContentType(content_type);
ServletOutputStream sos = response.getOutputStream();
sos.write(byteArray);
sos.flush();



where content_type is image/gif etc

For the my current laszlo client I spawn a pop up (using javascript) and stream the above to that popup window.

But I rather use a fade/in fade/out (or some other such laszlo action) but I do not know how to stream that image to the (laszlo) canvas.

I was hoping for some input from one of the Laszlo team member, but then maybe this is currently undoable.

rajs1
10-29-2004, 11:52 PM
Just to complete this thread and for the benefit of all others, when I direct the above servlet output to a view it seems to work.

The code is as follows:

I define a view as:

<view id="imageview" x="10" width="480" height="320" visible="false"/>


Then , as part of another action (which happens to be a click on a grid row), I do the following:


var url = 'http://localhost:8080/imageservlet/servlet/display?action=search&command=details&image_id='+id;
imageview.setResource(url);
imageview.setVisible(true);


Hope this helps.

Cheers
-raj