I'm positioning a circular picture with a transparent background using a script on another image. When I upload it, the removed pink background colour reappears, but when I open the circle picture in the browser, the pink background colour is gone. It is visible.
 $img1 = imagecreatefromjpeg("/path/uploads/resized-".$_POST["photo"]);
  $x=imagesx($img1)-$width ;
  $y=imagesy($img1)-$height;
  $img2 = imagecreatetruecolor($x, $y);
  $bg = imagecolorallocate($img2, 255, 200, 255);
  imagefill($img2, 0, 0, $bg);
  $e = imagecolorallocate($img2, 0, 0, 0);
  $r = $x <= $y ? $x : $y;
  imagefilledellipse($img2, ($x/2), ($y/2), $r, $r, $e); 
  imagecolortransparent($img2, $e);
  imagecopymerge($img1, $img2, 0, 0, 0, 0, $x, $y, 100);
  imagecolortransparent($img1, $bg);
  $tempimageround = str_replace('.jpg','','/path/uploads/circle-'.$_POST["photo"]).'.png';
  imagepng($img1,$tempimageround);  
  $new_photo2 = imagecreatefrompng($tempimageround);
imagecopy($jpg_image, $new_photo2, $photoleft, $phototop, 0, 0,$photowidth, $photoheight);
imagedestroy($img2);
imagedestroy($img1);
When placed on top of $jpg image, /path/uploads/circle-photo.png maintains the background colour of 255,200,255 while having a transparent backdrop when viewed in the browser. I'm unsure of what I'm lacking.