title: Why does imagecopymerge fail to load png images when loaded in different order? PHP
body: <pre><code>$result=count($ingredient);
  $height=$result*100+350;
    $my_img = imagecreate( 703, $height );
    $black = imagecolorallocate($my_img, 0, 0, 0);
    $my_img1 = imagecreatefrompng("./Ingredients/topbun.png");
    $my_img3 = imagecreatefrompng("./Ingredients/bottombun.png");
    imagecopymerge($my_img, $my_img1, 0, 0, 0, 0, 700, 250, 100);
    $yaxis=150;
    $small='mustard &amp; ketchup &amp; mayo &amp; bbq &amp; brown mustard &amp; chipotle mayo';
    for ($x=0; $x&lt;$result;$x++) {
            $smallcheck=strpos($small, $ingredient[$x-1]);
            if ($smallcheck===false) {
            $yaxis=$yaxis+105;
            } else {$yaxis=$yaxis+38;
            }
            $my_img2 = imagecreatefrompng("./Ingredients/$ingredient[$x].png");
            imagecopymerge($my_img, $my_img2, 0, $yaxis, 0, 0, 700, 100, 100);
            };
    $last = end($ingredient);
    $buncheck=strpos($small, $last);
   if ($buncheck===false) {
            $yaxis=$yaxis+105;
            } else {$yaxis=$yaxis+38;
            }
    imagecopymerge($my_img, $my_img3, 0, $yaxis, 0, 0, 700, 100, 100);
    imagecolortransparent($my_img, $black);
    $my_img4 = imagecreate(703, $yaxis+103);
    imagecopymerge($my_img4, $my_img, 0, 0, 0, 0, 703, $yaxis+103, 100);
    imagecolortransparent($my_img4, $black);
    imagepng( $my_img4, "./burgerpics/".$data[0].".png" );
    imagedestroy($my_img4);
  </code></pre>
  
  <p>This is a code I have designed to create a png image of a burger based upon user input. The code was working great, but then I included a new ingredient (lettuce). When I put lettuce on top of the burger patty, the burger patty disappears. When the lettuce is underneath the burger patty, they both appear fine. </p>
  
  <p>I thought that it may have to do with file size, as lettuce is the largest ingredient file I have created (27.6KB). I am not convinced though, because that is still an incredibly small file. </p>
  
  <p>Any ideas about what may be causing this?</p>
  
  <p><a href="http://i.stack.imgur.com/TKNFS.png" rel="nofollow"> Lettuce on top of burger patty</a></p>
  
  <p><a href="http://i.stack.imgur.com/jLuAy.png" rel="nofollow">Lettuce under burger patty</a></p>