title: Aligning php Generated Image dynamic text in center
body: <p>i want to align the text generated on the image to the center of the image. for the moment, i dont know if it is possible to align it. below is the code. </p>
  
  <pre><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);
  </code></pre>
  
  <p>thanks for the help guys.</p>