title: PHP imagecopy & imagecopymerge changing background from transparent to black
body: <p>I am copying one image and placing over second image, second image is transparent in background. While copying background of second image is converted to black. Even if i display image just after initializing image from file, it gives me black background. Please help.. </p>
  
  <pre><code>&lt;?php  
  
  header('Content-type:image/png'); 
  
  $watermark = imagecreatefrompng('eye.png');  
  
  $watermark_width = imagesx($watermark);  
  
  $watermark_height = imagesy($watermark);  
  
  $image = imagecreatetruecolor($watermark_width, $watermark_height);  
  
  $image = imagecreatefrompng('img.png');  
  
  $size = getimagesize('img.png');  
  
  $dest_x = $size[0] - $watermark_width - 5;  
  
  $dest_y = $size[1] - $watermark_height - 5;  
  
  imagecopyresampled($image, $watermark, 5, 5, 0,0,55 ,55, $watermark_width, $watermark_height);  
  //imagecopymerge($image, $watermark, 5, 5, 0, 0, $watermark_width, $watermark_height, 50);  
  
  imagejpeg($image);  
  
  imagedestroy($image);  
  
  imagedestroy($watermark);  
  ?&gt;
  </code></pre>