$imageFile = "/home/boutell/images/test.gif"; if (!open(GIF, $imageFile)) { # All is not well print "Status: 404 Not Found\n\n"; print "dimage could not find the image to send!\n"; exit 0; } binmode(GIF); # All is well print "Content-type: image/gif\n\n"; # Do reads of up to 4096 bytes at a time instead # of reading line-by-line. This is binary data and # line breaks may be few and far between. binmode(STDOUT); while (read(GIF, $buffer, 4096)) { print $buffer; } close(GIF); exit 0;