Getting gibberish from imagecopy function,
<p>Hia, I have just made the code:</p>

<pre><code>&lt;?php
$ur = $user['Skin'];

$filename = "img/Skins/" . $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="&lt;?php print_r(imagepng($dst_im)); ?&gt;"/&gt;
</code></pre>

<p>What this is supposed to do is get the image "Skin" and cut out the head, so my image:</p>

<pre><code>&lt;img src="&lt;?php print_r(imagepng($dst_im)); ?&gt;"/&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Œ+‰?>¡·Ñ[ïªWf™.œsá¸œ3€@á¦~vþf ŒÀì¢ ª}à9¹#åIÄ‰ê•¡
  èˆÀî”Ûw¥@ù"¢¢™áHªUúÝ¸÷ÉÇYÿ®šGÅçÇ˜îwqžˆ³ýÏJ
  ÕKSêô¯Tis“†Ã¡í©ÈK‡}G:Xqt×ÓIJEpT,úŽ¿ƒ~¼lÞÈ­Ú6]_Óœ>®çqÿNÏ‘çqWŠjš-…(—=g¿ÁŸÍgæ+ùB¹R©ÖwÜ¸þn¤:C‰õØËüÛïÝ±I¸°\ÉÌ[%«V³7ÞÕM¾Í>[ké·IEND®B`‚1"/></p>
</blockquote>

<p>What should I do, and how can I fix it?</p>

<p>Thanks!</p>
