Click to See Complete Forum and Search --> : Broken image using CGI on the fly generation of image file


wallg
11-02-2007, 09:03 PM
Using-
Apache 2.x
HP-UX 11.11
CGI script written in ksh
gnuplot 4.0
ppmtogif

Getting a broken image (red X) displayed in browser instead of the on-the-fly generated image.

ksh CGI script-
...
echo "Content-type: image/gif\n\n"
ppmtogif file.ppm 2>/dev/null

HTML file-
<html>
<body>
<h4>Text</h4>
<IMG SRC="http://server.com:8888/cgi-bin/script.ksh" alt="Alt text" BORDER=0>
</body>
</html>

Is there something else the CGI script should be sending?

Added these 2 lines to the Apache httpd.conf-

AddHandler cgi-script .ksh
AddType image/gif .gif

Are there other modifications to the httpd.conf that I should make?

The script works on the command line, successfully generating the GIF file.

Any ideas or tips would be greatly appreciated.

Thanks.

burakismet
11-03-2007, 03:21 PM
it's nice. thnak you

Burak İsmet BAŞARI

wallg
11-05-2007, 03:07 PM
I got it working using the HTML and ksh CGI script.

I changed the line-

echo "Content-Type: image/gif\n\n"
to
echo "Content-Type: image/gif\n"

What led me to look at that was using "lynx -head URL" for the CGI ksh script. Lynx was complaining "unknown or unsupported image file". The temporary file that lynx was dumping out was one character larger than the image file the script created when I ran it on the command line.

Not sure why it only wanted one "\n". Other scripts I've seen use "\n\n".

Thanks for the feedback.