title: Watermark an Image using Text in PHP
body: <p>I have an image and I'm trying to watermark the image using text.</p>
  
  <p>I have done with code part, but no image see been viewed with watermark text.</p>
  
  <p>Here is the code below:</p>
  
  <pre><code>$imagetobewatermark="images/muggu.png";
  list($width,$height)=getimagesize($imagetobewatermark);
  $imagetobewatermark=imagecreatetruecolor($width,$height);
  $mark=imagecreatefrompng($imagetobewatermark);
  imagecopy($imagetobewatermark,$mark,0,0,0,0,$width,$height);
  $wartermarktext="Muggu";
  $font="../font/century gothic.ttf";
  $fontsize="15";
  $white = imagecolorallocate($imagetobewatermark, 255, 255, 255);
  imagettftext($imagetobewatermark, $fontsize, 0, 20, 10, $white, $font, $watermarktext);
  header("Content-type:image/png");
  imagepng($imagetobewatermark);
  imagedestroy($imagetobewatermark);
  </code></pre>
  
  <p>Tell me If I'm wrong.</p>
  
  <p>Thank you.</p>