title: PNG file is NOT keeping transparency?
body: <p>I'll be using these variables throughout: </p>
  
  <pre><code>$ROOTDIR = $_SERVER["DOCUMENT_ROOT"];
  $ROOTFILE = "http://www.scottandjessiecooper.com/webtutorials/images/smiley.png";
  $NEWFILE = "$ROOTDIR/images/tmp/new_smiley.png";
  </code></pre>
  
  <p>When I use this function, I have NO problems with transparency </p>
  
  <pre><code>function save_image($root, $saveto){
      copy($root, $saveto);
  }
  save_image( $ROOTFILE, $NEWFILE ); // root can be file or url
  </code></pre>
  
  <p>However I <strong>NEED</strong> to use an <strong>IMAGE_RESOURCE</strong> so i cam manipulate the <strong>ROOTFILE</strong> if needed</p>
  
  <p>So i treid this:</p>
  
  <pre><code>if ( file_exists( $NEWFILE ) ) unlink ($NEWFILE);
  $image = imagecreatefrompng( $ROOTFILE );
  imagepng( $image, $NEWFILE );
  imagedestroy( $image );
  </code></pre>
  
  <p>Now when I use this:</p>
  
  <pre><code>&lt;img src="&lt;?=$NEWFILE?&gt;" /&gt;
  </code></pre>
  
  <p>I lose the transparency. The background goes BLACK!</p>
  
  <p>So I tried outputting the image to make sure it wasn't the <strong>saving</strong> that caused the problem:</p>
  
  <pre><code>if ( file_exists( $NEWFILE ) ) unlink ($NEWFILE);
  $image = imagecreatefrompng( $ROOTFILE );
  header('Content-Type: image/png');
  imagepng( $image );
  imagedestroy( $image );
  </code></pre>
  
  <p>Still to no avail...</p>
  
  <p>Help?</p>