#!/usr/bin/perl # pixel.cgi -- Generate a single-pixel GIF of a given color. # # Usage: # <img src="pixel.cgi/CC9966.gif" width=25 height=25> # # Dave W. Smith <dws@davewsmith.com> my($rgb) = $ENV{PATH_INFO} =~ m|/([0-9A-Za-z]{6})(?:\.gif)?$|i; $rgb ||= '888888'; my $gif = pack("H*", '47494638396101000100B30000' . $rgb . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'FFFFFFFFFFFFFFFFFFFFFFFFFF2C0000' . '0000010001000004021044003B' ); binmode(STDOUT); print "Content-type: image/gif\r\n"; print "Content-length: ", length($gif), "\r\n"; print "\r\n"; print $gif;
In reply to On-demand single-pixel GIFs by dws
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |