title: making mix image with gd
body: <p>im trying to make a form with php and gd library.
  form contains a png logo with transparent packgroung.
  now i have 3 problems:</p>
  
  <ol>
  <li><p>when i make a border then i want to place the logo in top corner of
  image, its not transparented background anymore</p></li>
  <li><p>im using persian font and using imagettftext function. it show the
  characters but in persian we have merged words but it show
  characters seperated</p></li>
  <li>how can i draw rounded corner borders</li>
  </ol>
  
  <p>here is my code:</p>
  
  <pre><code>$fontSize=4;
  $width = imagefontwidth($font) * strlen($string)+10 ;
  $height = imagefontheight($font) ;
  
  
  $handle = ImageCreate (800, 400) or die ("Cannot Create image");
  $logo = imagecreatefrompng( 'Logo.png' );
  
  $bg_color = ImageColorAllocate ($handle, 255, 240, 250);
  $txt_color = ImageColorAllocate ($handle, 0, 0, 0);
  
  $title="فرم قرارداد";
  $font = "IRANSans.ttf";
  $title_size = 18;
  imagettftext( $handle, $title_size, 0, 620, 100, $txt_color, $font, $title );
  
  $black = imagecolorallocate($handle, 0, 0, 0);
  imagerectangle($handle, 20, 20, 780, 380, $black);
  imagecopy($handle, $logo, 10, 10, 0, 0, 161, 160);
  
    header('Content-Type: image/png');
      imagepng($handle);
  </code></pre>