title: Getting gibberish from imagecopy function,
body: <p>Hia, I have just made the code:</p>
  <pre><code>&lt;?php
  $ur = $user['Skin'];
  
  $filename = &quot;img/Skins/&quot; . $ur;
  list($w, $h, $type, $attr) = getimagesize($filename);
  $img = imagecreatefrompng($filename); 
  $src_im = imagecreatefrompng($filename);
  $src_x = '30';   // begin x
  $src_y = '45';   // begin y
  $src_w = '40'; // width
  $src_h = '35'; // height
  $dst_x = '0';   // destination x
  $dst_y = '0';   // destination y
  
  $dst_im = imagecreatetruecolor($src_w, $src_h);
  $white = imagecolorallocate($dst_im, 255, 255, 255);
  imagefill($dst_im, 0, 0, $white);
  
  imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
  
  ?&gt;
  &lt;img src=&quot;&lt;?php print_r(imagepng($dst_im)); ?&gt;&quot;/&gt;
  </code></pre>
  <p>What this is supposed to do is get the image &quot;Skin&quot; and cut out the head, so my image:</p>
  <pre><code>&lt;img src=&quot;&lt;?php print_r(imagepng($dst_im)); ?&gt;&quot;/&gt;
  </code></pre>
  <p>Should only be the head of the skin. However, I am being given this gibberish:</p>
  <blockquote>
  <p>ù¬åä) BðÔ€ÛÂ~Í‹P3£Œ´¶ÛÛ A†YEUkÌ¡èæ_Ê!ÊÔgò
  s“Û¤ÇC‚MŒ+‰?&gt;¡·Ñ[ïªWf™.œsá¸œ3€@á¦~vþf ŒÀì¢ ª}à9¹#åIÄ‰ê•¡
  èˆÀî”Ûw¥@ù&quot;¢¢™áHªUúÝ¸÷ÉÇYÿ®šGÅçÇ˜îwqžˆ³ýÏJ
  ÕKSêô¯Tis“†Ã¡í©ÈK‡}G:Xqt×ÓIJEpT,úŽ¿ƒ~¼lÞÈ­Ú6]_Óœ&gt;®çqÿNÏ‘çqWŠjš-…(—=g¿ÁŸÍgæ+ùB¹R©ÖwÜ¸þn¤:C‰õØËüÛïÝ±I¸°\ÉÌ[%«V³7ÞÕM¾Í&gt;[ké·IEND®B`‚1&quot;/&gt;</p>
  </blockquote>
  <p>What should I do, and how can I fix it?</p>
  <p>Thanks!</p>