Ausrichten von php Generiertes Bild einen dynamischen text in der Mitte

will ich richten Sie den generierten text auf dem Bild in der Mitte des Bildes. für den moment, ich weiß nicht, ob es möglich ist, auszurichten. unten ist der code.

$im = @imagecreatefromjpeg('poloroid.jpg');

//Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
//imagefilledrectangle($im, 0, 0, 399, 29, $white);

//The text to draw
//$text = 'John...';
$fbid = $_POST["id"]; 
$text = $_POST["want"];
$fb_email =$_POST["email"];
$fb_name=$_POST["name"];

$uploads_dir = 'uploaded_files/';
//Replace path by your own font path
$font = 'verdana.ttf';

//image file name
//$name ="$fbid.png";
$name = $uploads_dir.$fbid.".png"; //this saves the image inside uploaded_files folder

//Add some shadow to the text
imagettftext($im, 20, 0,  25, 126, $grey, $font, $text);

//Add the text
imagettftext($im, 20, 0, 25, 125, $black, $font, $text);

//Using imagepng() results in clearer text compared with imagejpeg()
//imagepng($im);
imagepng($im,$name,9);
imagedestroy($im);

danke für die Hilfe Jungs.

InformationsquelleAutor Shazery Nasir | 2013-01-25

Schreibe einen Kommentar