title: php GD create a transparent png image
body: <p>I'm trying to create a transparent png image and layer various other pngs and jpgs to create a final png with transparency. I'm having trouble creating my initial empty transparent png. It currently has a white background.</p>
  
  <p>Can anyone point me in the right direction. This is my code so far...</p>
  
  <pre><code>$image = imagecreatetruecolor(485, 500);
  imagealphablending($image, false);
  imagesavealpha($image, true);
  $col=imagecolorallocatealpha($image,255,255,255,127);
  imagefill($image, 0, 0, $col);
  //imagefilledrectangle($image,0,0,485, 500,$col);
  
  
  /* add door glass */
  $img_doorGlass = imagecreatefrompng("glass/$doorStyle/$doorGlass.png");     
  imagecopyresampled($image, $img_doorGlass, 106, 15, 0, 0, 185, 450, 185, 450);              
  
  
  /* add door */
  $img_doorStyle = imagecreatefrompng("door/$doorStyle/$doorStyle"."_"."$doorColor.png");     
  imagecopyresampled($image, $img_doorStyle, 106, 15, 0, 0, 185, 450, 185, 450);
  
  
  $fn = md5(microtime()."door_builder").".png";
  
  if(imagepng($image, "user_doors/$fn", 1)){
    echo "user_doors/$fn";
  }       
  imagedestroy($image);       
  </code></pre>