title: Unusual result when merging two transparent images in php
body: <p>Im wondering if I'm doing something wrong, or if this is as good a result as im going to get. Both PNGs on the left are 95x111. The image of the robot has a 5px or so padding of transparent pixels around it, but it seems to be causing problems when they merge?</p>
  
  <p><img src="https://i.stack.imgur.com/Dyo4J.jpg" alt="enter image description here"></p>
  
  <pre><code> $avatar = imagecreatefrompng("../guy.png");
   $borderImg = imagecreatefrompng("../frame.png");
  
   imagealphablending( $borderImg, false );
   imagesavealpha( $borderImg, true );
  
   imagecopyresampled($avatar,$borderImg,  0, 0, 0, 0, 95, 111,95, 111);
   imagepng($avatar, $newfilenameBig); 
  </code></pre>
  
  <p>Ive tried every combo of imagealphablending and imagesavealpha I can think of. When I set $avatar to imagesavealpa= true, then it doesnt even show the image as all, just the frame. Doesn't that seem strange?
  Is this as far as i'm gonna get using PHP GD? </p>
  
  <p>UPDATE: The desired result can be achieved when both images are created manually in PS using 24 bit mode. Is there a way to do this using imagecopy or similar?</p>