bladx has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use GD; my $im = new GD::Image(100,100); my @colors; # Preallocate colors, since PNG has a limited number of co +lors for (0..255) { $colors[$_] = $im->colorAllocate(int(rand(256)),int(rand(256)),int(ran +d(256))); } for my $x (0..99) { for my $y (0..99) { $im->setPixel($x,$y,$colors[int(rand(255))]); } } print "Content-Type: image/png\n\n"; print $im->png;
#!/usr/bin/perl -w print "Content-type: text/html\n\n"; print<<HTML; <html><head><title>testing more</title></head> <body bgcolor=#ffffff> <center> HTML print "Content-type: image/png\n\n"; print "<img src='gd1.pl' height=100 width=100>\n"; print<<HTML; </center> </body> </html> HTML
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Displaying randomly created png's in HTML
by count0 (Friar) on Aug 21, 2001 at 20:54 UTC | |
|
Re: Displaying randomly created png's in HTML
by Jouke (Curate) on Aug 21, 2001 at 21:56 UTC | |
|
Re: Displaying randomly created png's in HTML
by Beatnik (Parson) on Aug 21, 2001 at 22:31 UTC | |
|
Re: Displaying randomly created png's in HTML
by bladx (Chaplain) on Aug 22, 2001 at 00:24 UTC |