Witam, witam, witam. Przejdę od razu do sedna sprawy. Mam problem, to oczywiste. Znalazłem na internecie, generator userbarów. Wszystko działa pięknie, po - przerabiałem go wszystko działa. Tylko że chciałbym zrobić coś takiego, bo mam 10 teł do wyboru, i chciałem zrobić tak że jak ktoś wchodzi na index wpisuje ten swój tekst to odrazu pokazują sie te tła z jego napisem. A pokazuje się tylko pierwszy obrazek, i nic więcej. Narobiłem syfu w generatorze, ale sam juz nie wiem jak to zrobić.
To jest ta moja zabawa. (outline/stroke, czyli obrys napisów sam dodawałem i działa.)
<?php
function imagettftextoutline(
$image,
$size,
$angle,
$x,
$y,
$color,
$fontfile,
$text,
$outlinewidth = 1, // 1px outline
$outlinecolor = 0 // black
) {
// First offset diagonally
imagettftext($image, $size, $angle, $x - $outlinewidth,
$y - $outlinewidth, $outlinecolor, $fontfile, $text);
imagettftext($image, $size, $angle, $x - $outlinewidth,
$y + $outlinewidth, $outlinecolor, $fontfile, $text);
imagettftext($image, $size, $angle, $x + $outlinewidth,
$y - $outlinewidth, $outlinecolor, $fontfile, $text);
imagettftext($image, $size, $angle, $x + $outlinewidth,
$y + $outlinewidth, $outlinecolor, $fontfile, $text);
// Then offset orthogonally
imagettftext($image, $size, $angle, $x - $outlinewidth, $y,
$outlinecolor, $fontfile, $text);
imagettftext($image, $size, $angle, $x + $outlinewidth, $y,
$outlinecolor, $fontfile, $text);
imagettftext($image, $size, $angle, $x, $y - $outlinewidth,
$outlinecolor, $fontfile, $text);
imagettftext($image, $size, $angle, $x, $y + $outlinewidth,
$outlinecolor, $fontfile, $text);
// Output text
imagettftext($image, $size, $angle, $x, $y, $color, $fontfile,
$text);
}
header("Content-type: image/png");
$obraz1 = imagecreatefrompng("blekit.png");
$obraz2 = imagecreatefrompng("czerw.png");
$obraz3 = imagecreatefrompng("czerw2.png");
$obraz4 = imagecreatefrompng("default.png");
$obraz5 = imagecreatefrompng("niebieski.png");
$obraz6 = imagecreatefrompng("ogien.png");
$obraz7 = imagecreatefrompng("pink.png");
$obraz8 = imagecreatefrompng("pink2.png");
$obraz9 = imagecreatefrompng("pl.png");
$obraz10 = imagecreatefrompng("pomaranczowe.png");
$obraz11 = imagecreatefrompng("szare.png");
$obraz12 = imagecreatefrompng("zielone.png");
$obraz13 = imagecreatefrompng("zolty.png");
$czcionka_biala1 = imagecolorallocate($obraz1, 255, 255, 255);
$czcionka_czarna1 = imagecolorallocate($obraz1, 0, 0, 0);
$czcionka_biala2 = imagecolorallocate($obraz2, 255, 255, 255);
$czcionka_czarna2 = imagecolorallocate($obraz2, 0, 0, 0);
$czcionka_biala3 = imagecolorallocate($obraz3, 255, 255, 255);
$czcionka_czarna3 = imagecolorallocate($obraz3, 0, 0, 0);
$czcionka_biala4 = imagecolorallocate($obraz4, 255, 255, 255);
$czcionka_czarna4 = imagecolorallocate($obraz4, 0, 0, 0);
$czcionka_biala5 = imagecolorallocate($obraz5, 255, 255, 255);
$czcionka_czarna5 = imagecolorallocate($obraz5, 0, 0, 0);
$czcionka_biala6 = imagecolorallocate($obraz6, 255, 255, 255);
$czcionka_czarna6 = imagecolorallocate($obraz6, 0, 0, 0);
$czcionka_biala7 = imagecolorallocate($obraz7, 255, 255, 255);
$czcionka_czarna7 = imagecolorallocate($obraz7, 0, 0, 0);
$czcionka_biala8 = imagecolorallocate($obraz8, 255, 255, 255);
$czcionka_czarna8 = imagecolorallocate($obraz8, 0, 0, 0);
$czcionka_biala9 = imagecolorallocate($obraz9, 255, 255, 255);
$czcionka_czarna9 = imagecolorallocate($obraz9, 0, 0, 0);
$czcionka_biala10 = imagecolorallocate($obraz10, 255, 255, 255);
$czcionka_czarna10 = imagecolorallocate($obraz10, 0, 0, 0);
$czcionka_biala11 = imagecolorallocate($obraz11, 255, 255, 255);
$czcionka_czarna11 = imagecolorallocate($obraz11, 0, 0, 0);
$czcionka_biala12 = imagecolorallocate($obraz12, 255, 255, 255);
$czcionka_czarna12 = imagecolorallocate($obraz12, 0, 0, 0);
$czcionka_biala13 = imagecolorallocate($obraz13, 255, 255, 255);
$czcionka_czarna13 = imagecolorallocate($obraz13, 0, 0, 0);
$tekst1 = $_GET['tekst1'];
$tekst2 = $_GET['tekst2'];
$tekst3 = $_GET['tekst3'];
$tekst4 = $_GET['tekst4'];
$tekst5 = $_GET['tekst5'];
$tekst6 = $_GET['tekst6'];
$tekst7 = $_GET['tekst7'];
$tekst8 = $_GET['tekst8'];
$tekst9 = $_GET['tekst9'];
$tekst10 = $_GET['tekst10'];
$tekst11 = $_GET['tekst11'];
$tekst12 = $_GET['tekst12'];
$tekst13 = $_GET['tekst13'];
$font1 = 'visitor1.ttf';
$font2 = 'visitor1.ttf';
$font3 = 'visitor1.ttf';
$font4 = 'visitor1.ttf';
$font5 = 'visitor1.ttf';
$font6 = 'visitor1.ttf';
$font7 = 'visitor1.ttf';
$font8 = 'visitor1.ttf';
$font9 = 'visitor1.ttf';
$font10 = 'visitor1.ttf';
$font11 = 'visitor1.ttf';
$font12 = 'visitor1.ttf';
$font13 = 'visitor1.ttf';
imagettftextoutline($obraz1, 8, 0, 260, 13, $czcionka_biala1, $font1, $tekst1, 1);
imagettftextoutline($obraz2, 8, 0, 260, 13, $czcionka_biala2, $font2, $tekst2, 1);
imagettftextoutline($obraz3, 8, 0, 260, 13, $czcionka_biala3, $font3, $tekst3, 1);
imagettftextoutline($obraz4, 8, 0, 260, 13, $czcionka_biala4, $font4, $tekst4, 1);
imagettftextoutline($obraz5, 8, 0, 260, 13, $czcionka_biala5, $font5, $tekst5, 1);
imagettftextoutline($obraz6, 8, 0, 260, 13, $czcionka_biala6, $font6, $tekst6, 1);
imagettftextoutline($obraz7, 8, 0, 260, 13, $czcionka_biala7, $font7, $tekst7, 1);
imagettftextoutline($obraz8, 8, 0, 260, 13, $czcionka_biala8, $font8, $tekst8, 1);
imagettftextoutline($obraz9, 8, 0, 260, 13, $czcionka_biala9, $font9, $tekst9, 1);
imagettftextoutline($obraz10, 8, 0, 260, 13, $czcionka_biala10, $font10, $tekst10, 1);
imagettftextoutline($obraz11, 8, 0, 260, 13, $czcionka_biala11, $font11, $tekst11, 1);
imagettftextoutline($obraz12, 8, 0, 260, 13, $czcionka_biala12, $font12, $tekst12, 1);
imagettftextoutline($obraz13, 8, 0, 260, 13, $czcionka_biala13, $font13, $tekst13, 1);
imagepng($obraz1);
imagepng($obraz2);
imagepng($obraz3);
imagepng($obraz4);
imagepng($obraz5);
imagepng($obraz6);
imagepng($obraz7);
imagepng($obraz8);
imagepng($obraz9);
imagepng($obraz10);
imagepng($obraz11);
imagepng($obraz12);
imagepng($obraz13);
imagedestroy($obraz1);
imagedestroy($obraz2);
imagedestroy($obraz3);
imagedestroy($obraz4);
imagedestroy($obraz5);
imagedestroy($obraz6);
imagedestroy($obraz7);
imagedestroy($obraz8);
imagedestroy($obraz9);
imagedestroy($obraz10);
imagedestroy($obraz11);
imagedestroy($obraz12);
imagedestroy($obraz13);
?>
A normalnie, bez mojej przeróbki wygląda tak.
<?php
header("Content-type: image/png");
$obraz = imagecreatefrompng("geo.png");
$czcionka_biala = imagecolorallocate($obraz, 255, 255, 255);
$czcionka_czarna = imagecolorallocate($obraz, 0, 0, 0);
$tekst = $_GET['tekst'];
$font = 'arial.ttf';
imagettftext($obraz, 11, 0, 5, 14, $czcionka_biala, $font, $tekst);
imagepng($obraz);
imagedestroy($obraz);
?>
Potrzebuje pomocy, dzięki.

// edit:
Lub ktoś mógłby mi wytłumaczyć jak zrobić coś takiego że w indexie jest coś takiego że klika się: i ma do wyboru tło: czerwone, niebieskie i tak dalej...
Ten post edytował tomaz 29.01.2011, 21:58:19