I have a PHP script that creates a very tall image and draws a lot of lines on it (organizational view on the Internet). For the tallest images I tried to create, the line drawing just stops abruptly in the middle of the image: http://i.imgur.com/4Plgr.png
I ran into this problem using imagecreate (), then found that imagecreatetruecolor () can handle large images, so I switched to this. I still have the same problem, but the script can now handle slightly larger images. I think it should be about 1200 lines. A script requires no more than 3 seconds. Here is the complete image: http://i.imgur.com/PaXrs.png
I adjusted the memory limits with ini_set ('memory_limit', '1000M'), but my scripts never get close to the limit.
How to get a script to continue drawing until it ends? Or how can I use PHP to create an image using less memory (which I think is the problem)?
if(sizeof($array[0])<300) $image=imagecreate($width,$height); else $image=imagecreatetruecolor($width,$height); imagefill($image,0,0,imagecolorallocate($image,255,255,255)); for($p=0; $p<sizeof($linepoints); $p++){ $posx1=77+177*$linepoints[$p][0]; $posy1=-4+46*$linepoints[$p][1]; $posx2=77+177*$linepoints[$p][2]; $posy2=-4+46*$linepoints[$p][3]; $image=draw_trail($image,$posx1,$posy1,$posx2,$posy2); } imagepng($image,"images/table_backgrounds/table_background".$tsn.".png",9); imagedestroy($image); function draw_trail($image,$posx1,$posy1,$posx2,$posy2){ $black=imagecolorallocate($image,0,0,0); if($posy1==$posy2) imageline($image,$posx1,$posy1,$posx2,$posy2,$black); else{ imageline($image,$posx1,$posy1,$posx1+89,$posy1,$black); imageline($image,$posx1+89,$posy1,$posx1+89,$posy2,$black); imageline($image,$posx1+89,$posy2,$posx2,$posy2,$black); } return $image; }