title: PHP imagecopy removing png's color
body: <p>I am trying to make a blackjack game that teaches card counting.  The visual component is important so I have a mock up of a deck of cards and some code that copies each dealt card's png file into a larger image to display the player and dealer's hands.  Unfortunately, every once in a while, my imagecopy is copying just a couple png's without color (in grayscale).  Here is the code for image creation, the rest of the code seems to be behaving flawlessly:</p>
  
  <pre><code>$cards = imagecreate( 360, 600 );
  
  imagecopy( $cards, drawCard($dealershand[0]), 10, 10, 0, 0, 171, 254 );
  imagecopy( $cards, @imagecreatefrompng("deckback.png"), 190, 10, 0, 0, 171, 254 );
  
  imagecopy( $cards, drawCard($playershand[0]), 10, 336, 0, 0, 171, 254 );
  imagecopy( $cards, drawCard($playershand[1]), 190, 336, 0, 0, 171, 254 );
  </code></pre>
  
  <p>If you need more code, just let me know and I can supply it but basically "drawCard" contains basically an if statement for red or black card and then a switch for the face value and outputs the <code>@imagecreatefrompng( carddealt )</code>, with card dealt file name generated inside as mocked up.  <code>$dealershand</code> and <code>$playershand</code> are just arrays of two cards, each with a face and suit value.  </p>
  
  <p>Thanks and sorry if this is already answered.</p>