GD::Graph::bars

A

Alexandre Jaquet

Hi,

I need to print out some text before and after an image,
how can I commbine text + image

right now I use and have try the commented solution but doesn't
work

use GD::Graph::bars;

#print "Content-type: image/html\n\n";
#print "test";
my $img = generate();
print "Content-type: image/jpeg\n\n";
print $img;


sub generate {
my @data = ( ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
[ 10],
[ 119] );
my $graph = GD::Graph::bars->new(300, 300);
$graph->set( title => "Evaluation vente",
y_label => "Nombre de ventes");
$graph->set_legend( "Négatif (0)",
"Positif (12)");
my $gd = $graph->plot(\@data);
binmode STDOUT;

return $gd->jpeg(100);
}


thanks
 
M

Miroslav Suchy

Alexandre said:
Hi,

I need to print out some text before and after an image,
how can I commbine text + image

perldoc GD
Look for chapter "Character and String Drawing"


Try this:
use GD;
use GD::Graph::bars;

my $img = generate();
print "Content-type: image/jpeg\n\n"; binmode STDOUT;
print $img;


sub generate {
my @data = ( ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
[ 10],
[ 119] );
my $graph = GD::Graph::bars->new(300, 300);
$graph->set( title => "Evaluation vente",
y_label => "Nombre de ventes");
$graph->set_legend( "Négatif (0)",
"Positif (12)");
my $gd = $graph->plot(\@data); $gd->string(gdSmallFont,2,10,"test",$peach);

return $gd->jpeg(100);
}


Miroslav Suchy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top