patawic Posted November 29, 2010 Share Posted November 29, 2010 Im trying to make a script that previews the level for a game, but im having issues with transparency and the rotation of each image. you can see the problem here: http://beta.trackmill.com/DUI/preview/ here is the php file <?php header('Content-Type: image/png'); $image = imagecreatefrompng('images/Background.png'); function radiansToDegrees($radians) { return $radians * 180 / pi(); } $map = file_get_contents('map.txt'); $blocks = split("<obj", $map); for($i=2; $i<count($blocks); $i++) { $arg = split(" ", $blocks[$i]); $n = str_replace("n", "", str_replace("=", "", str_replace('"', "", $arg[1]))); $x = str_replace("x", "", str_replace("=", "", str_replace('"', "", $arg[2]))); $x = $x * 20 - 13; $y = str_replace("y", "", str_replace("=", "", str_replace('"', "", $arg[3]))); $y = $y * 22 + 15; $a = str_replace("a", "", str_replace("=", "", str_replace('"', "", $arg[4]))); $a = radiansToDegrees($a); $t = str_replace("t", "", str_replace("=", "", str_replace('"', "", $arg[5]))); $e = str_replace("e", "", str_replace("=", "", str_replace('"', "", $arg[6]))); $f = str_replace("f", "", str_replace("=", "", str_replace('"', "", str_replace('/>', "", $arg[7])))); $blockimage = imagecreatefrompng("images/$n.png"); $blockimage = imagerotate($blockimage, -$a, 0, 0) ; imagealphablending($blockimage, false); imagesavealpha($blockimage, true); imagecopy($image, $blockimage, $x, $y, 0, 0, imagesx($blockimage), imagesy($blockimage)); //echo "$i | $n - $x - $y - $a - $t - $e - $f <br>"; } imagepng($image); imagedestroy($image); ?> if you require the .zip containing the images etc, just reply and i will upload it as soon as possible Link to comment https://forums.phpfreaks.com/topic/220096-imagerotate-removing-transparency/ Share on other sites More sharing options...
BlueSkyIS Posted November 29, 2010 Share Posted November 29, 2010 have you tried putting the alpha functions before imagerotate? just an idea. Link to comment https://forums.phpfreaks.com/topic/220096-imagerotate-removing-transparency/#findComment-1140759 Share on other sites More sharing options...
patawic Posted November 29, 2010 Author Share Posted November 29, 2010 yes i have it makes no difference. Link to comment https://forums.phpfreaks.com/topic/220096-imagerotate-removing-transparency/#findComment-1140773 Share on other sites More sharing options...
patawic Posted November 29, 2010 Author Share Posted November 29, 2010 still havent managed to solve this :/ Link to comment https://forums.phpfreaks.com/topic/220096-imagerotate-removing-transparency/#findComment-1140989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.