Alinear el texto dinámico de la imagen generada por php en el centro

Quiero alinear el texto generado en la imagen con el centro de la imagen. Por el momento, no sé si es posible alinearlo. A continuación se muestra el código.

$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);

Gracias por la ayuda chicos.

Respuestas a la pregunta(5)

Su respuesta a la pregunta