perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Andrew O'Brien)
Subject Re: Generating images on-the-fly (newbie question)
Date Thu, 10 Oct 2002 01:26:03 GMT
On Wed, Oct 09, 2002 at 05:02:36PM -0700, Daniel Barbar wrote:
> 	I'd like to generate web-enabled reports (graphs, actually, using
> the Perl module GD::Graph) on data from a database using
> Apache/mod-perl/Embperl(1.3.4)/DBI/DBD-Oracle.

> 	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
( is usually useful.

You can output a gif directly from embperl so:

<img src="graph.html?args=go&here=">


 $req = shift;
 $http_headers_out{'Content-type'} = 'image/gif';
 $escmode=0; # This is important

 $gd = set up stuff here;

 print OUT $gd->plot(@data)->gif();

Make sure there is no extraneous whitespace in this file as this will
get sent to the browser, ie the first and last characters are [ and

 Andrew O'Brien
 Senior Engineer                       email:
 Switch Online Group Pty Limited       phone: +61 2 9299 1133
 ABN 89 092 286 327                    fax:   +61 2 9299 1134

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message