You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "R.P. Aditya" <ad...@grot.org> on 2000/12/28 10:40:49 UTC

CGI generated image/png problem?

I have a simple script dynamically generating a PNG based on form input:

--------------------
  #!/usr/bin/perl
  # genImage.perl
  use strict;
  
  print <<LLI;
  Content-type: image/png
  
  LLI
  
  genPNG(); #a subroutine that can produce PNGs using libpng
--------------------

this worked fine before I used mod_perl. I've tried using:

  $q->header('image/png');

instead of the print "Content-Type" line, to no avail.  Annoyingly enough, if
I generate a jpeg ($q->header('image/jpeg')), albeit with a different library
routine, it works fine...

Other possibly relevant details:

Apache/1.3.12 (Unix) mod_perl/1.23

and in httpd.conf:

<Files *.perl>
   SetHandler perl-script
   PerlHandler Apache::Registry
   PerlSendHeader On
   Options +ExecCGI
</Files>

I've even tried with PerlSendHeader Off and adding "HTTP 1/1 200 OK" headers
with the same result -- jpegs work fine, PNG does not...

Clues? I suspect it's a problem with the PNG production and some intereaction
between mod_perl and the headers that stock Apache doesn't encounter, but will
be most interested if there might be another explanation or solution.

Thanks,
Adi

Re: CGI generated image/png problem?

Posted by "R.P. Aditya" <ad...@grot.org>.
In case anyone was wondering, found another thread in reference to it and the
"solution":

  http://www.egroups.com/message/modperl/26850
  http://www.ee.ethz.ch/~slist/rrd-users/msg01700.html
  http://www.ee.ethz.ch/~slist/rrd-users/msg01704.html

The problem is with older versions of libgd...

Adi

On Thu, Dec 28, 2000 at 01:40:49AM -0800, R.P. Aditya wrote:
> I have a simple script dynamically generating a PNG based on form input:
> 
> --------------------
>   #!/usr/bin/perl
>   # genImage.perl
>   use strict;
>   
>   print <<LLI;
>   Content-type: image/png
>   
>   LLI
>   
>   genPNG(); #a subroutine that can produce PNGs using libpng
> --------------------
> 
> this worked fine before I used mod_perl. I've tried using:
> 
>   $q->header('image/png');
> 
> instead of the print "Content-Type" line, to no avail.  Annoyingly enough, if
> I generate a jpeg ($q->header('image/jpeg')), albeit with a different library
> routine, it works fine...
> 
> Other possibly relevant details:
> 
> Apache/1.3.12 (Unix) mod_perl/1.23
> 
> and in httpd.conf:
> 
> <Files *.perl>
>    SetHandler perl-script
>    PerlHandler Apache::Registry
>    PerlSendHeader On
>    Options +ExecCGI
> </Files>
> 
> I've even tried with PerlSendHeader Off and adding "HTTP 1/1 200 OK" headers
> with the same result -- jpegs work fine, PNG does not...
> 
> Clues? I suspect it's a problem with the PNG production and some intereaction
> between mod_perl and the headers that stock Apache doesn't encounter, but will
> be most interested if there might be another explanation or solution.
> 
> Thanks,
> Adi
>