title: How to save image after add text to an Image
body: <p>In order to add text to an image I'm using below code from a site </p>
  
  <pre><code>&lt;?php
      //Set the Content Type
      header('Content-type: image/jpeg');
  
      // Create Image From Existing File
      $jpg_image = imagecreatefromjpeg('sunset.jpg');
  
      // Allocate A Color For The Text
      $white = imagecolorallocate($jpg_image, 255, 255, 255);
  
      // Set Path to Font File
      $font_path = 'font.TTF';
  
      // Set Text to Be Printed On Image
      $text = "This is a sunset!";
  
      // Print Text On Image
      imagettftext($jpg_image, 25, 0, 75, 300, $white, $font_path, $text);
  
      // Send Image to Browser
      imagejpeg($jpg_image);
  
      // Clear Memory
      imagedestroy($jpg_image);
  ?&gt; 
  </code></pre>
  
  <p>It is working well but I am unable to save in pic for text file saving i am using this 
  function</p>
  
  <pre><code>function write($post,$myFile){
      $fh = fopen($myFile, 'a+') or die("can't open file");
      fwrite($fh, $post);
      fclose($fh);
  } 
  </code></pre>
  
  <p>Is there any way I can able to save image in jpg ?</p>