title: PHP imagecopymerge Cannot merge jpg and png into a single new image
body: <p>I have tried many stackoverflow answers but cannot get solution what i want, my code cannot merge properly both images into a new image.</p>
  
  <p><img src="https://i.stack.imgur.com/P0bwD.jpg" alt=""></p>
  
  <p>and I don't want to use ImageMagic Lib</p>
  
  <pre><code>$height = 527;
  $width = 1350;
  
  $back_img = 'http://localhost/testphoto/Mtw2xHqGGd5FkDF2eQ4Z.png';
  $front_img = 'http://localhost/testphoto/BHp7zWb8MB18sr8mzY1v________________.png';
  
  
  $image = imagecreatefromstring(file_get_contents($back_img));
  $frame = imagecreatefromstring(file_get_contents($front_img));
  
  
  $image = imagecreatefrompng($back_img);
  $frame = imagecreatefrompng($front_img);
  
  imagecopymerge($frame, $image, 100, 100, 100, 100, 100, $height, $width);
  
  
  imagepng($image, 'image.png');
  </code></pre>