bkswindell Posted May 1, 2007 Share Posted May 1, 2007 Hello, thanks for taking the time to help. Ive designed a code to create an image that uses user input of 8 or less chars, and converts it to an array and displays the correct image for each char. So far the code works 95% it creates the image ok execpt for a few conditions. Ok so http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=12345678 Works http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=1 Works http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=12 Works http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=123 Freezes ??? http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=1234 Works http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=12345 Works and the rest works up to 12345678 and the other condition: http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=%20%20%20%20%20%20%201 Works http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=%20%20%20%20%20%2012 Freezes ??? http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=%20%20%20%20%20123 Works And so on to %201. Im think it has some to do with the math but im not finding and problems. Any help would be much appricated. Also feel free to do and testing of other contitions. Brad <?php header('content-type: image/jpeg'); $image = imagecreatefromgif('emp.gif'); $size = getimagesize('emp.gif'); $strings = $_GET['strings']; $len = strlen($strings); $cur = 0; $characterarray = array(); while($cur < $len){ $char = $strings{$cur}; array_push($characterarray,$char); $cur = $cur + 1; } /* "*---*" " --" */ $car1 = imagecreatefromgif($characterarray[0].'.gif'); $car2 = imagecreatefromgif($characterarray[1].'.gif'); $car3 = imagecreatefromgif($characterarray[2].'.gif'); $car4 = imagecreatefromgif($characterarray[3].'.gif'); $car5 = imagecreatefromgif($characterarray[4].'.gif'); $car6 = imagecreatefromgif($characterarray[5].'.gif'); $car7 = imagecreatefromgif($characterarray[6].'.gif'); $car8 = imagecreatefromgif($characterarray[7].'.gif'); $dest_x = 17; $dest_y = 33; $dest_x1 = 17; $dest_x2 = 43; $dest_x3 = 69; $dest_x4 = 95; $dest_x5 = 121; $dest_x6 = 147; $dest_x7 = 173; $dest_x8 = 199; imagecopymerge($image, $car1, $dest_x1, $dest_y, 0, 0, imagesx($car1), imagesy($car1), 100); imagecopymerge($image, $car2, $dest_x2, $dest_y, 0, 0, imagesx($car2), imagesy($car2), 100); imagecopymerge($image, $car3, $dest_x3, $dest_y, 0, 0, imagesx($car3), imagesy($car3), 100); imagecopymerge($image, $car4, $dest_x4, $dest_y, 0, 0, imagesx($car4), imagesy($car4), 100); imagecopymerge($image, $car5, $dest_x5, $dest_y, 0, 0, imagesx($car5), imagesy($car5), 100); imagecopymerge($image, $car6, $dest_x6, $dest_y, 0, 0, imagesx($car6), imagesy($car6), 100); imagecopymerge($image, $car7, $dest_x7, $dest_y, 0, 0, imagesx($car7), imagesy($car7), 100); imagecopymerge($image, $car8, $dest_x8, $dest_y, 0, 0, imagesx($car8), imagesy($car8), 100); imagejpeg($image); $filename = $characterarray[0].$characterarray[1].$characterarray[2].$characterarray[3].$characterarray[4].$characterarray[ 5].$characterarray[6].$characterarray[7].".jpg"; if (is_file($filename)) { readfile($filename); exit; } imagejpeg($image,$filename); imagedestroy($image); imagedestroy($car1); imagedestroy($car2); imagedestroy($car3); imagedestroy($car4); imagedestroy($car5); imagedestroy($car6); imagedestroy($car7); imagedestroy($car8); ?> Link to comment https://forums.phpfreaks.com/topic/49463-solved-image-creation-freezes-under-werid-condition/ Share on other sites More sharing options...
monk.e.boy Posted May 1, 2007 Share Posted May 1, 2007 http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=888? Very odd. My guess would be the GD has a bug in it. Try doing the same stuff but with .bmps and save it as a bmp as well. jpg and png have different types of compression which may be throwing a weird bug? monk.e.boy Link to comment https://forums.phpfreaks.com/topic/49463-solved-image-creation-freezes-under-werid-condition/#findComment-242452 Share on other sites More sharing options...
bkswindell Posted May 1, 2007 Author Share Posted May 1, 2007 Ok ive found out that the images that is creating is actuly ok its the image that is actuly displayed on the screen... http://bkswindell.dyndns.org:8091/dev/project/trunk/php/test4.php?strings=256 http://bkswindell.dyndns.org:8091/dev/project/trunk/php/256.jpg This is very weird. Its like its not able to complete the process for some reason. But it works on every other image. Link to comment https://forums.phpfreaks.com/topic/49463-solved-image-creation-freezes-under-werid-condition/#findComment-242464 Share on other sites More sharing options...
monk.e.boy Posted May 1, 2007 Share Posted May 1, 2007 So maybe dump the image to disk then display it in a normal HTML page? Or is this what you're doing anyway? Sounds like another PHP bug ;-) monk.e.boy Link to comment https://forums.phpfreaks.com/topic/49463-solved-image-creation-freezes-under-werid-condition/#findComment-242507 Share on other sites More sharing options...
bkswindell Posted May 1, 2007 Author Share Posted May 1, 2007 Yea thats what I was going to do... Thanks. Link to comment https://forums.phpfreaks.com/topic/49463-solved-image-creation-freezes-under-werid-condition/#findComment-242513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.