title: Is there any php function that returns an image handle so that i can use it in img src html tag?
body: <p>I tried this <a href="http://php.net/manual/en/function.imagejpeg.php" rel="nofollow">imagejpeg()</a> php method, but it returns an image to a browser on running the code. </p>
  
  <p>However I need a method that returns an image URL so that i can use it in my img tag.</p>
  
  <p>Currently i have to use -</p>
  
  <pre><code>&lt;img src="siteurl/myphpfile.php" /&gt;
  </code></pre>
  
  <p>but i think its better if the method returns an image handler so that i can use it in my img tag, like -</p>
  
  <pre><code>&lt;img src="image.jpg" /&gt;
  </code></pre>
  
  <p>My myphpfile.php is the file that contains the code.</p>
  
  <p>Searched many functions at php manuals but no luck, I am also using this method <code>imagettftext()</code> for text addition over image.</p>
  
  <p>Total code in the File --</p>
  
  <pre><code>&lt;?php
      function myimagecreate( $myname ) {
      $headurl = 'template_header01.jpg';
      header('Content-type: image/jpeg');
      $text = "My Full Text";
      $name = $text.".jpg";
      $jpg_image = imagecreatefromjpeg($headurl);
      $black = imagecolorallocate($jpg_image, 1, 1, 1);
      $font_path = 'myfont/arial.ttf';
      imagettftext($jpg_image, 24, 0, 175, 85, $black, $font_path, $text);
      imagejpeg($jpg_image,'mynameimg.jpg');
      imagedestroy($jpg_image);
      return 'mynameimg.jpg';
      }
  
      $to = 'swapnesh20032003@gmail.com';
      $subject = $myname; 
      $message = '&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Kings&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;table width="100%"&gt;&lt;tr&gt;&lt;td valign="bottom" align="center" height="282"&gt;&lt;img src="'.myimagecreate( $myname ).'" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;';
  
  mail($to,$subject,$message);    
  ?&gt;
  </code></pre>