Psilo
Threadersteller
Dabei seit: 20.02.2007
Ort: -
Alter: 35
Geschlecht:
|
Verfasst Fr 16.07.2010 00:41
Titel php bild erstellen - farbübergabe per get |
|
|
jemand ne ahnung warum folgendes script nicht funzt?
erstelle ein bild mit php
darin wird text ausgegeben
ich will dem text ne farbe über ne get variable übergeben und dem hintergrund auch
also das hier ($color[0]*1), ($color[1]*1), ($color[2]*1)
und das hier ($background[0]*1), ($background[1]*1), ($background[2]*1)
die ausgabe ist dann z.b. 255, 255, 255
wenn ich anstelle von z.b. ($background[0]*1), ($background[1]*1), ($background[2]*1) einfach 255,255,255 eingebe dann gehts
also ich kann die farben einfach nicht über geht übergeben
nur manuell funzt es bisher
Code: | <?php
$text = $_GET['text'];
$background = $_GET["background"];
$color = $_GET["color"];
$background = split(",",$background);
$color = split(",",$color);
function jsFont($which) {
header("Content-type: image/png");
$im = imagecreate (($_GET["width"]*1), ($_GET["height"]*1));
$col = ImageColorAllocate ($im, ($color[0]*1), ($color[1]*1), ($color[2]*1));
$bac = ImageColorAllocate ($im, ($background[0]*1), ($background[1]*1), ($background[2]*1));
ImageTTFText ($im, $_GET["size"], 0, 0, $_GET["size"], $bac, $_SERVER["DOCUMENT_ROOT"]."/font-machine/font/".$_GET["font"], $which);
imagepng($im);
ImageDestroy ($im);
}
echo jsFont($text);
?> |
|
|