I was programming a little plugin, which generates an image via Perl GD and displays it in the browser. So far everything works correct, except that the image is displayed in binary character stream. It's rather annoying to google this kind of problem, because I read about temporarily saving the file to the hard disk, which I would love to avoid.
This is the code I have so far:
$image = $print->png; ## the image was created correctly, I was able to
#view it if I saved it on the local drive
my $cgi = new CGI;
print $cgi -> header(),
$cgi -> start_html(),
$cgi -> h1('Bernd'),
$cgi -> header(-type=>'image/png');
binmode STDOUT;
print $image;
print $cgi -> end_html();
To I have to call a special method of the CGI module? Because I did not find one I am a little bit confused.
Any help is appreciated. Thanks in advance!