title: imagettftext function not working in php
body: <p>I have the following code for my captcha. The lines in the image are generated but the 4 digit number is not displayed. I assume there is some problem in     </p>
  
  <p><strong>imagettftext($image,$font_size,0,15,30,$text_color,'font.TTF',$text);</strong></p>
  
  <p>function of code. I tried setting the path to the font file using $_server['DOCUMENT_ROOT']; yet didn't work. </p>
  
  <p>here's the code:</p>
  
  <pre><code>        &lt;?php
      session_start();
      header('Content-type: image/jpeg');
  
      $text= $_SESSION['secure'];
  
      $font_size =30;
      $image_width= 110;
      $image_height=40;
  
      $image=imagecreate($image_width,$image_height);
      imagecolorallocate($image, 255, 255, 255);
      $text_color = imagecolorallocate($image, 0, 0, 0);
  
  
      for($x=1; $x&lt;=30; $x++){
          $x1 = rand(1,100);
          $x2 = rand(1,100);
          $y1 = rand(1,100);
          $y2 = rand(1,100);
      imageline($image, $x1, $x2, $y1, $y2, $text_color);
      }
  
      imagettftext($image,$font_size,0,15,30,$text_color,'font.TTF',$text);
      imagejpeg($image);
      ?&gt;
  </code></pre>