in reply to How can I use a CGI script to return an image?
In case the OP was actually wanting to use the script to return an image, not html, here's another way to do it. This script uses LWP to grab an image from another server and send it along. You can use it inside the src attribute of an image tag.
Williamuse LWP::UserAgent; my $ua = LWP::UserAgent->new; my $response = $ua->get('http://www.perl.org/simages/lcamel.gif'); die "Unable to retrieve image." unless ($response->is_success); print "Content-type: image/jpeg\n\n"; print $response->content;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Answer: How can I use a CGI script to return an image?
by Trimbach (Curate) on Oct 14, 2005 at 13:17 UTC |