|
Posted by Krustov on 06/08/07 13:58
<comp.lang.php>
<Geoff Berrow>
<Fri, 08 Jun 2007 14:27:48 +0100>
<p5mi6314qktqmnkhhgmaic32vs44sqsc7r@4ax.com>
> Sometimes a little knowledge can be a dangerous thing.
>
It can also be a good thing as a little knowledge allowed me to write
the code to create the faded bars for www.freeviewepg.co.uk instead of
creating them manually in a image app .
Although www.freeviewepg.co.uk/coming_up.php is probably a better
example of the fade bars in use rather than whats on the home page .
Hell even some of the variable names are sensible :-)
$new_name="images/cu_bar_$tempbar.jpg";
$pass=1;
if (!file_exists($new_name)) {$pass=0;}
if ($pass==0)
{
$drawbar=$tempbar;
if ($tempbar==150) {$drawbar=149;}
$source=imagecreatetruecolor(150,18);
$kol=imagecolorallocate($source,254,254,254); imagefilledrectangle
($source,0,0,150,18,$kol);
$kom=ImageColorAllocate($source,244,244,244); ImageLine
($source,0,0,149,0,$kom);
$kom=ImageColorAllocate($source,244,244,244); ImageLine
($source,149,0,149,18,$kom);
$kom=ImageColorAllocate($source,244,244,244); ImageLine
($source,0,18,149,18,$kom);
$jt1=150; $jt2=190; $jt3=170;
$dupp=0;
while ($dupp<$drawbar)
{
$kap=ImageColorAllocate($source,$jt1,$jt2,$jt3); ImageLine($source,
$dupp,0,$dupp,18,$kap);
if ($jt1<255) {$jt1=$jt1+1;}
if ($jt2<255) {$jt2=$jt2+1;}
if ($jt3<255) {$jt3=$jt3+1;}
$dupp=$dupp+1;
}
if ($drawbar>30) {$kop=ImageColorAllocate($source,220,220,220);
ImageLine($source,30,0,30,18,$kop);}
if ($drawbar>60) {$kop=ImageColorAllocate($source,245,245,245);
ImageLine($source,60,0,60,18,$kop);}
$kom=ImageColorAllocate($source,222,227,244); ImageLine($source,0,0,
$drawbar,0,$kom);
$kom=ImageColorAllocate($source,222,227,244); ImageLine
($source,0,0,0,18,$kom);
$kom=ImageColorAllocate($source,222,227,244); ImageLine($source,0,18,
$drawbar,18,$kom);
ImageJPEG($source,$new_name,90);
imagedestroy($source);
}
[Back to original message]
|