You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jacek Kempski <jk...@jacekkempski.com> on 2001/05/14 20:56:16 UTC

Stream over template?

Hello,

how can i send a dynamically created image based on data retrieved from the database? Do
i have to save the image temporarily on the HD and pass the URL to the template? Or is
there another possibility ?

Thanks to everyone, special thanks to Geir for the previous help.

jack.

jk@jacekkempski.com
jacek@camline.com

Re: Stream over template?

Posted by "Kyle F. Downey" <kd...@amberarcher.com>.
Jacek Kempski wrote:

> Hello,
> 
> how can i send a dynamically created image based on data retrieved from 
> the database? Do i have to save the image temporarily on the HD and pass 
> the URL to the template? Or is there another possibility ?
> 

Why not embed a URL that points directly to the servlet reading the data from
the database?

img src="/servlet/DataSource" 

so long as that servlet puts the right header on it (image/gif or image/jpeg)
it should work. There's nothing template-specific about that.....

--kd

> Thanks to everyone, special thanks to Geir for the previous help.
> 
> jack.
> 
> jk@jacekkempski.com
> jacek@camline.com



Re: Stream over template?

Posted by Jon Stevens <jo...@latchkey.com>.
Turn off that html email please.

on 5/14/01 11:56 AM, "Jacek Kempski" <jk...@jacekkempski.com> wrote:

> Hello, 
> 
> how can i send a dynamically created image based on data retrieved from the
> database? Do i have to save the image temporarily on the HD and pass the URL
> to the template? Or is there another possibility ?

You can do either of both. You can put the image data byte[] into the
context and have a template which only contains a reference to the context
variable or you can save the image to disk within your htdocs and reference
it in your template or you can just have the url point to a servlet which
then returns the image (no need for velocity overhead).

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/ymtd/ymtd.html>