0; $x--) { $colorBreakdown = imagecolorsforindex($image, (imagecolorat($image, $x, $y))); if ($colorBreakdown['alpha'] < 127) { break; } else { $imagemap[$y]++; } } } } // This second loop generates $sandbag, which is a less perfect // array of the empty space we have detected, and is // based on our specified sandbag height. for($i=0;$i < count($imagemap); $i = $i+$sandbagHeight) { for($x=0;$x < $sandbagHeight; $x++) { $b = $x + $i; if(isset($imagemap[$b])) { $section[$b] = $imagemap[$b]; } } $sandbag[] = min($section); $finalSectionSize = count($section); unset($section); } // Here we specify the template for our sandbags $sandbagTemplate = '
'; // This final loop generates each of our sandbags if($alt != '') { echo '