## base64 encoded images
##
$images['null'] = 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['_brown'] = 'R0lGODlhAQABAIAAAH8AAP///ywAAAAAAQABAAACAkQBADs=';
$images['_blue'] = 'R0lGODlhAQAJAJEAAAAAAP///wAA/zc/PywAAAAAAQAJAAACA5RvUwA7';
$images['_green'] = 'R0lGODlhAQAJAJEAAAAAAP///zc/PzF6CywAAAAAAQAJAAACA5xvUgA7';
$images['_margenta']= 'R0lGODlhAQAJAJEAAAAAAP///9MAizc/PywAAAAAAQAJAAACA5RvUwA7';
$images['_yellow'] = 'R0lGODlhAQAJAJEAAAAAAP///zc/P/v8nywAAAAAAQAJAAACA5xvUgA7';
$images['blue'] = 'R0lGODlhAQABAIAAAAAA/wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['darkblue'] = 'R0lGODlhAQABAIAAAEpYogAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['pureblue'] = 'R0lGODlhAQABAIAAAD13swAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['brown'] = 'R0lGODlhAQABAIAAAHsAAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['green'] = 'R0lGODlhAQABAIAAAAB9RQAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['grey'] = 'R0lGODlhAQABAIAAAOjs6AAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['lightgrey']= 'R0lGODlhAQABAIAAANHY0gAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['darkgrey'] = 'R0lGODlhAQABAIAAAIycjwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['margenta'] = 'R0lGODlhAQABAIAAANsAmgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['red'] = 'R0lGODlhAQABAIAAANxEHAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['yellow'] = 'R0lGODlhAQABAIAAAP/3AAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
shell> which base64
alias base64='/usr/lib/python1.5/base64.py'
/usr/lib/python1.5/base64.py
shell> base64 -e foo.gif > foo.gif.enc
<?php
function header_imcache($days=1)
{
global $_SERVER; // for PHP/4.0.x
$expire = (int)$days * 86400; // alway $days > 0
$time['req'] = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); // request time
$time['cur'] = time(); // current time
$time['chk'] = $time['cur'] - $expire; // filemtime() bad speed
if($time['req'] > $time['chk']) // exclude '='
{
header('HTTP/1.1 304 Not Modified');
exit; // don't print any messages
}
header('Expires: '.gmdate('D, d M Y H:i:s T',$time['cur']+$expire));
header('Last-Modified: '.gmdate('D, d M Y H:i:s T')); // GMT of current
header('Cache-control: private, max-age='.$expire.', pre-check='.$expire);
return TRUE; // alway true
}
header_imcache();
$images = array();
$images['null'] = '....';
...
$images['yellow'] = '....';
$color = 'red'; // color name
header('Content-type: image/gif');
echo base64_decode($images[$color]);
exit; // don't print any messages
?> |