title: PHP GD drawing pixel data from array stops mid loop
body: <p>I have an array of pixel data in a JSON object. I'm attempting to use PHP to redraw the pixel data to a GD image.</p>
  
  <p>I'm using something like the following (Notice for testing purposes, I've started the index for the loop at 5000, about halfway into the array.)</p>
  
  <pre><code>$im = imagecreate($w,$h);
  $i=5000;
  while($i &lt; count($pixels)){
      $item = $data[$i];
      $rgb = $item['rgb'];
      $pos = $item['pos'];
      $col = imagecolorallocate($im, $rgb[0],$rgb[1],$rgb[2]);
      imagesetpixel($im , $pos[0], $pos[1], $col);
      $i++;
  }
  header("Content-Type: image/png");
  imagepng($im);
  </code></pre>
  
  <p>It seems my script is only making it so far down the array before it cuts out and dumps the image out with no error.</p>
  
  <p>Below is the output when I start the array index about halfway thru the length of the array. I get a very small part of the image.</p>
  
  <p><img src="https://i.stack.imgur.com/qbukQ.png" alt="enter image description here"></p>
  
  <p>Is this due to memory? Or a timeout? The page doesn't take long to load or anything...</p>