in reply to How can I use a CGI script to return an image?

I assume you mean "how do I have a CGI program called from an image and have the CGI program pipe an image back to the IMG tag for display"?

First off is the image tag. Nothing special here, it should looks just like a normal image tag except it calls your CGI and passes the apropriate parameters to it:

<img src="img_gen.cgi?size=100">
The interesting part is in your CGI. You need to return apropriate HTTP headers for the image (Content-Type: image/gif or whatever is apropriate). and then just pipe the image contents back. Here's a small CGI program that returns an image, its size based on the passed parameter
#!/usr/bin/perl -w use strict; use CGI; use GD; my $cgi=new CGI; my $cgi_size=$cgi->param('size') || '50'; print "Content-type: image/gif\n\n"; my $gd=new GD::Image($cgi_size,$cgi_size); my $blue=$gd->colorAllocate(0,0,255); $gd->fill(0,0,$blue); binmode STDOUT; #just in case we're on NT print $gd->gif;