Gut Danke so weit erledigt aber die schrift macht irgendwie noch Probleme. Habe es schon mit 2 Schriftarten versucht aber bei beiden im Hintergrund ist es weiß. Kannst du mir da auch noch einen Tipp geben ob das an der Schriftart oder an was anderem liegt.
z.b. http://imagesandmore.mx.am/altrot-.png
[code]<?php
header(“Content-Type: image/png”);
$ausw = explode(’-’,$_GET[‘ausw’]);
$hintergrund = $ausw[0];
//Zufallsbild aus Datenbank
@mysql_connect(“localhost”,“imi”,"");
@mysql_select_db(“imagesandmore_pi”);
$sql = “SELECT pic_kl FROM images WHERE freigabe=‘1’ ORDER BY RAND() LIMIT 0,1”;
$result = @mysql_query($sql);
$row = @mysql_fetch_assoc($result);
$bild = $row[pic_kl];
// Bild laden
$imgzufall = imagecreatefrompng($bild);
$imgzufall2 = imagecreatefrompng("./schrift/leer.png");
$img = imagecreatefrompng("./schrift/leer.png");
// Bilder Transparent machen
imagealphablending($img, false);
imagesavealpha($img, true);
imagealphablending($imgzufall2, false);
imagesavealpha($imgzufall2, true);
// Bild Infos
$width = ‘468’;
$breite = imagesx($imgzufall);
$height = ‘60’;
$hoehe = imagesy($imgzufall);
// Farben
$color[‘altrot’] = imagecolorallocate($img, 139, 8, 10);
$color[‘black’] = imagecolorallocate($img, 0, 0, 0);
$color[‘black’] = imagecolorallocate($img, 0, 0, 0);
if($hintergrund == ‘altrot’) {
imagefill($img, 0, 0, $color[‘altrot’]);
imagefill($imgzufall2, 0, 0, $color[‘altrot’]);
} else if($hintergrund == ‘trans’) {
imagecolortransparent($img, $color[‘black’]);
} else if($hintergrund == ‘trans’) {
imagecolortransparent($img, $color[‘black’]);
}
//Zufallsbild verkleinern
if ($hoehe > ‘50’) {
$breite_old = $breite;
$hoehe_old = $hoehe;
$hoehe = ‘50’;
$breite = intval($breite_old * ($hoehe / $hoehe_old));
imagecopyresampled($imgzufall2, $imgzufall, 0, 0, 0, 0, $breite, $hoehe, $breite_old, $hoehe_old);
} else {
$imgzufall2 = $imgzufall;
}
$width = ‘5’;
$height = ‘5’;
imagecopy($img, $imgzufall2, $width, $height, 0, 0, 130, 130);
// Text hinzufügen
$text = “Dieses und viele weitere Bilder auf”;
$link = “imagesandmore.mx.am”;
$color = ImageColorAllocate($img, 0, 0, 0); //Farbe
if($ausw[1] != ‘2345’) {
$ttf = “./schrift/XFILES.TTF”; //Schriftart
} else {
$ttf = “./schrift/zh.ttf”; //Schriftart
}
$ttfsize = 10; //Schriftgrˆsse
$angle = 0; //rand(0,5);
$t_x = 130; //von links
$t_y = 20; //von oben
imagettftext($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text);
imagettftext($img, $ttfsize, 0, 300, 50, $color, $ttf, $link);
// Bild anzeigen
imagepng($img);
// Speicher freigeben
imagedestroy($img);
?>[/code]