<?php
header("Content-type image/jpeg");
$height = 5;
// colors to fade
$red_start   = 150;
$red_end     = 255;
$green_start = 0;
$green_end   = 255;
$blue_start  = 0;
$blue_end    = 255;
$im = @ImageCreate($width,$height) or die ("no image possible");
function dif ($start,$end)
{
	if ($start >= $end)
		$dif = $start - $end;
	else
		$dif = $end - $start;
		
	return $dif;
}
function draw($start,$end,$pos,$step_width)
{
	if ($start > $end)	
		$color = $start - $step_width * $pos;
	else
		$color = $start + $step_width * $pos;
		
	return $color;
}	
// difference between start and end
$dif_red = dif($red_start,$red_end);
$dif_green = dif($green_start,$green_end);
$dif_blue = dif($blue_start,$blue_end);
// width of one color step
$step_red = $dif_red / $width;
$step_green = $dif_green / $width;
$step_blue = $dif_blue / $width;
$height = $height-1;
for ($pos=0; $pos<=$width; $pos++)
{
	$color = ImageColorAllocate($im,draw($red_start,$red_end,$pos,$step_red),
						   			draw($green_start,$green_end,$pos,$step_green),
						   			draw($blue_start,$blue_end,$pos,$step_blue));	
	
	imageline($im,$pos,"0",$pos,$height,$color);
	
}
imagejpeg($im);
imagedestroy($im);
?> 
  |