Hia, I have just made the code:
<?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);
?>
<img src="<?php print_r(imagepng($dst_im)); ?>"/>
What this is supposed to do is get the image "Skin" and cut out the head, so my image:
<img src="<?php print_r(imagepng($dst_im)); ?>"/>
Should only be the head of the skin. However, I am being given this gibberish:
ù¬åä) 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"/>
What should I do, and how can I fix it?
Thanks!
A solution is to use your php script as the
srcattribute of you<img>tag:yourScript.php
Markup