in reply to Mixing HTML and GIF
script1.cgi (this method will also work if the HTML is not dynamically generated):script2.cgi#!/usr/bin/perl -w use strict; print "Content-type: text/html\n\n"; print <<EOT; <html><head><title>Image Example<title></head> <body> <img src="script2.cgi?size=20"> </body> EOT#!/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); print $gd->gif;
script3.cgi (assuming the images are named banner1.gif to banner8.gif)#!/usr/bin/perl -w use strict; my $rnd=int(rand()*8); my $img="images/banner".$rnd".gif"; print "Content-type: text/html\n\n"; print <<EOT; <html><head><title>Another Image Example<title></head> <body> <img src="$img"> </body> EOT
|
|---|