Servus
Ich habe da ein kleines Problem und brauche nun echt eure Hilfe. Ich möchte ein dynamisches Bild erzeugen und dafür Texte über ein Logo legen. Funktioniert soweit auch super nur sind die Schriftarten nicht schön (ob mit oder ohne AntiAlias spielt keine Rolle, man sieht keinen Unterschied). GBLIB ist installiert (die Bundled Version, der Befehl sollte also funktionieren).
Dies ist mein Code
PHP-Code:
<?php
//Get the XML location
$ID=$_GET['id'];
$URL= "http://folding.extremeoverclocking.com/xml/user_summary.php?s=&u=" .$ID;
//Load the XML file
$obj_xml = simplexml_load_file ($URL);
//Fetch the data
$User_Name = $obj_xml->user[0]->User_Name[0];
$Rank = $obj_xml->team[0]->Rank[0];
$Team_Rank = $obj_xml->user[0]->Team_Rank[0];
$Points_plain = $obj_xml->user[0]->Points[0];
//Load the plain logo
$image = imagecreatefromjpeg ( 'NHFv6blank.jpg' );
//Anti-Alias
//imageantialias($image, true);
//Recalculation for thousand separator
$Points=number_format($Points_plain);
//Include the quotes
include ('./quotes.php');
//Allocate the data
$text1= $Rank;
$text2= "User: ".$User_Name;
$text3= "Points: ".$Points;
$text4= "Team Rank: ".$Team_Rank;
$text5= $quote;
//Define the font path, font, size and color
putenv('GDFONTPATH=./');
$font1 = 'CAMBRIA.TTC';
$font2 = 'forte.ttf';
$font3 = 'vijaya.ttf';
$font4 = 'vijayab.ttf';
$fontsize1 = 12;
$fontsize2 = 12;
$fontsize3 = 12;
$fontcolor1 = imagecolorallocate($image, 255, 255, 255);
$fontcolor2 = imagecolorallocate($image, 0, 0, 0);
$fontcolor3 = imagecolorallocate($image, 255, 255, 255);
//Write the text on the image with X Y coordinates
imagettftext($image, $fontsize2, 0, 225, 245, $fontcolor2, $font2, $text1);
imagettftext($image, $fontsize1, 0, 109, 15, $fontcolor1, $font3, $text2);
imagettftext($image, $fontsize1, 0, 109, 28, $fontcolor1, $font3, $text3);
imagettftext($image, $fontsize1, 0, 109, 41, $fontcolor1, $font3, $text4);
imagettftext($image, $fontsize3, 0, 5, 265, $fontcolor3, $font4, $text5);
//Save the image and clear the memory
header("Content-Type: image/png");
imagepng($image);
imagedestroy($image);
?>
Und das ist das Resultat
Egal ob ich nun "//imageantialias($image, true);" auskommentiere oder nicht, das Resultat ändert sich nicht. Liegt das vielleicht an den TTF Schriften? Und wenn ja, welchen Weg würdet Ihr einschlagen?
Danke im Vorraus
Muffel2k
