function create_gradient ($start_color, $end_color, $size, $thickness, $orientation
{
if ($orientation=="vertical") {
$imgimagecreatetruecolor$thickness$size);
} else {
$imgimagecreatetruecolor$size$thickness);
}
$start_r = hexdecsubstr$start_color, 0, 2));
$start_g = hexdecsubstr$start_color, 2, 2));
$start_b = hexdecsubstr$start_color, 4, 2));
$end_r = hexdecsubstr$end_color, 0, 2));
$end_g = hexdecsubstr$end_color, 2, 2));
$end_b = hexdecsubstr$end_color, 4, 2));
for ($i=0;$i$size$i++) {
$red = round$start_r - ($start_r$end_r) * ($i / ($size-1)));
$green = round$start_g - ($start_g$end_g) * ($i / ($size-1)));
$blue = round$start_b - ($start_b$end_b) * ($i / ($size-1)));
$color = imagecolorallocate$img, $red, $green, $blue);
if ($orientation=="vertical") {
for ($k=0;$k$thickness$k++)
imagesetpixel$img, $k, $i, $color);
} else {
for ($k=0;$k$thickness$k++)
imagesetpixel$img, $i, $k, $color);
}
}
return $img
}