perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wim Kerkhoff" <...@nyetwork.org>
Subject RE: Generating images on-the-fly (newbie question) / embperl object
Date Thu, 10 Oct 2002 05:47:23 GMT
> > 	Is there a way, using Embperl, to send the image back 
> to the browser 
> > on-the-fly, that is, without having to save it on a file first? 
> > Something
> 
> This is something that comes up rather frequently. For future 
> reference, doing a search of the embperl mail archives
> (http://www.ecos.de/~mailarc/embperl/) is usually useful.
> 
> You can output a gif directly from embperl so:
> 
> <img src="graph.html?args=go&here=">

Last week I tried a couple of ways of doing this under EmbperlObject.
That is, from somepage.html try to ignore the output of base.html and
set the headers and content manually, while still having access to
things bound to the request object $req.

Is that even possible? I ended up configuring a /cgi-bin and creating a
CGI.pm script to dump out my binary data.

init.html:

[- $req = shift; $req->{dbh} = DBI ...; -]


base.html:

<html>
[- Execute ('*') -]
</html>

somepage.html:

[-
$req = shift;
$dbh = $req->{dbh};
$http_headers_out{'Content-Type'} = "image/gif";
print OUT $dbh->selectrow_array("select imageblob from images where
id=234");	
-]


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message