The HTML page:
#!perl -w $| = 1; use strict; use CGI; my $CGI = CGI->new(); print $CGI->header('text/html'), <<'END_HTML'; <html> <head> <title>Sample Image Page</title> </head> <body> <img src="test.cgi" /> </body> </html> END_HTML
The perl script for the image (note that using read() is preferable compared to reading line-by-line when handling binary data such as images, as you may be pushing a lot of data into memory when you don't want to):
#!perl -w $| = 1; use strict; use CGI; my $CGI = CGI->new(); print $CGI->header('image/gif'); open( my $img, '<', 'packplan.gif' ) or die("open failed: $!"); binmode($img); binmode(STDOUT); while ( read($img, my $buf, 1024) ) { print $buf; } close($img) or die("close failed: $!");
In reply to Re: Image content help
by saskaqueer
in thread Image content help
by Mercio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |