You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonathan O'Connor <Jo...@xcom.de> on 2004/08/06 18:02:47 UTC

Re: Query regarding serving images [auf Viren geprueft]

DD,
Its fairly easy. We display lots of different types of files with the 
following lines of code:

            HttpServletResponse response = 
cycle.getRequestContext().getResponse();
            response.setContentType(fileDao.getMimeType());
            response.setHeader("Content-Disposition", "inline; 
Filename=\"" + fileDao.getFilename() + "\"");
            ServletOutputStream outStream = response.getOutputStream();
            outStream.write(fileDao.getData());
            outStream.flush();
            outStream.close();

Our fileDao contains a filename, a mimetype (you'll want something like 
"image/jpeg", but you probably already know that), and the raw binary 
data.

Ciao,
Jonathan O'Connor
XCOM Dublin



"Doc Digi" <sa...@digiatlas.net> 
06/08/2004 16:20
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>


To
"Tapestry users" <ta...@jakarta.apache.org>
cc

Subject
Query regarding serving images [auf Viren geprueft]






Does Tapestry come with any support for dynamic images? Specifically I 
have
several thousand pictures that I wish to display based on various search
criteria. The pictures are not all orientated correctly (they are all
landscape) - a database provides the filename of each picture and its
correct orientation. In my stand-alone application I just rotate the
pictures based on the value from the DB. I'd like to do the same in my
Tapestry app - so an href to the image file isn't going to do it as I need
to programatically rotate them.

My limited understanding indicates that this is possible from a servlet by
opening a stream and sending the binary data to the client... but how? And
how can I do it from Tapestry?

Any pointers greatly appreciated!

thanks,
dd




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org