Our Scripts Vault contains many game scripts that you can use to create your own game!
$ims=imagecreatefrompng($sourcefile);imagealphablending($ims, true);imagesavealpha($ims, true);$imd=imagecreatetruecolor($imgw,$imgh);imagealphablending($imd, true);imagesavealpha($imd, true);imagecopy($imd,$ims,0,0,$src_x,$src_y,$imgw,$imgh);imagepng($imd,$filesave);
I think you may have to use imagesavealpha() when working with PNGs.
http://www.php.net/manual/en/function.imagecolortransparent.php
$ims=imagecreatefrompng($sourcefile);$imd=imagecreate($imgw,$imgh);imagepalettecopy($imd,$ims);echo " ColoursTotal[S]: ".imagecolorstotal($ims);echo " ColoursTotal[D]: ".imagecolorstotal($imd);echo "<br>";// SET TRANSPARENT TO COLOUR FROM PIXEL (0,0)if($gettransparentfrom00){$rgb = imagecolorat($ims, 0, 0);$r = ($rgb >> 16) & 0xFF;$g = ($rgb >> 8) & 0xFF;$b = $rgb & 0xFF;$trs = ImageColorAllocate($ims, $r, $g, $b);$transparent_s=imagecolortransparent($ims,$trs);$trs = ImageColorAllocate($imd, $r, $g, $b);$transparent_d=imagecolortransparent($imd,$trs);echo"Get transparent colour from (0,0) = $transparent_s and $transparent_d<br>";}imagecopy($imd,$ims,0,0,$src_x,$src_y,$imgw,$imgh);imagepng($imd,$filesave);