Dinamikus kép... nincs hiba, de nem megy
<?php
error_reporting(E_ALL);
function gradient(&$image, $x1,$x2, $start, $end, $bc, $uc)
{
$bc = explode("|", $bc);
$uc = explode("|", $uc);
$hg = abs($start-$end);
$rp = substr($bc[0]-$uc[0]/$hg,0, 4);
$gp = substr($bc[1]-$uc[1]/$hg,0, 4);
$bp = substr($bc[2]-$uc[2]/$hg,0, 4);
for($fhg=0; $hg > $fhg; ++$fhg){
$tc=imagecolorallocate($image, (integer)$rp, (integer)$uc[1], (integer)$uc[2]);
imageline($image, $x1, $start+$fhg, $x2, $start+$fhg, $tc);
$uc[0] += $rp; $uc[1] += $gp; $uc[2] += $bp;}
global $image;
}
header("Content-type: image/png");
$kep = imagecreate(100, 50);
$szin = imagecolorallocate($kep, 134, 134, 34);
gradient($kep, 0, 99, 50, 0, "0|0|0", "200|200|200");
imagepng($kep);
?>
Mi lehet a hiba?
■ error_reporting(E_ALL);
function gradient(&$image, $x1,$x2, $start, $end, $bc, $uc)
{
$bc = explode("|", $bc);
$uc = explode("|", $uc);
$hg = abs($start-$end);
$rp = substr($bc[0]-$uc[0]/$hg,0, 4);
$gp = substr($bc[1]-$uc[1]/$hg,0, 4);
$bp = substr($bc[2]-$uc[2]/$hg,0, 4);
for($fhg=0; $hg > $fhg; ++$fhg){
$tc=imagecolorallocate($image, (integer)$rp, (integer)$uc[1], (integer)$uc[2]);
imageline($image, $x1, $start+$fhg, $x2, $start+$fhg, $tc);
$uc[0] += $rp; $uc[1] += $gp; $uc[2] += $bp;}
global $image;
}
header("Content-type: image/png");
$kep = imagecreate(100, 50);
$szin = imagecolorallocate($kep, 134, 134, 34);
gradient($kep, 0, 99, 50, 0, "0|0|0", "200|200|200");
imagepng($kep);
?>
Mi lehet a hiba?
Hoppá:)