Check out http://www.cs.ubc.ca/ftp/local/www/x-exec/examples/type/postnews
It's a sorta-CGI script that does the same kind of thing you want.
Basically, it takes the PATH_INFO it has and opens a file which it dumps
into a dynamically created <TEXTAREA> form element.
>I began by simply trying to return a GIF image from a script. (We're
>using httpd 1.0) A document contains <IMG SRC="/cgi-bin/getgif" ISMAP>.
>The script "getgif" spits out the mime header "Content-type: image/gif"
>then cats a sample GIF image. I can see from the logs that that Mosaic
>is issuing the GETs, but the image load is unsuccessful (I get the default
>NCSA icon). I also tried a script the just issues a "Location: <path>",
>where <path> pointed to the GIF file. Same result. Obviously, I am
>doing something wrong. Can anyone clue me in? Marc? Rob?
You have to be careful that you output "Content-type: image/gif\r\n\r\n".
You can test it by telnetting to your server -- if it spits
binary crap at you, it should be working. My guess is that it isn't
and you'll just see some error message.
The only trick with the Location: stuff is that it points to a "virtual"
file on your server and not a UNIX file.
-- George