title: Image create using gd
body: <p>I am creating image using GD library all the functions are working fine. But the main problem where i stucked that i want to merge png image over an other image but after overlapping it cannot merge properly and looking like jpg or other instead of png. I cannot upload my image here due to low reputation so click on these links below to see the image.</p>
  
  <p>The image which i want to merge is this</p>
  
  <p>Png image</p>
  
  <p><img src="https://i.stack.imgur.com/n0jvg.png" alt="png image"></p>
  
  <p>The image where i merge above image is:</p>
  
  <p><img src="https://i.stack.imgur.com/9PjMm.png" alt="merge with"></p>
  
  <p>My code is here:</p>
  
  <pre><code>&lt;?php
  $im = imagecreate(288,288);
  $background_color = imagecolorallocate($im, 230, 248, 248);
  $file = 'images/smiley/smile'.$_POST['smiley'].'.png'; 
  $bg = imagecreatefrompng($file);
  imagealphablending($im, true); 
  imagesavealpha($bg, true);
  imagecopyresampled($im, $bg, 80, 80, 0, 0, 50, 50, 185, 185);
  
                             header("Content-Type: image/png");
              $filename = $_SESSION['rand'].'.png';
              imagepng($im,$filename);
              echo '&lt;img src="'.$filename.'" alt="" /&gt;';
  ?&gt;
  </code></pre>