rendered paste body $picture_x = round(imagesx($image_handler));
$picture_y = round(imagesy($image_handler));
//$square_pieces = $this->difficulty * 3;
$square_pieces = 200; // 60 x 60 pieces.
$count = 0;
# Time to generate squares.
ob_start(); # lets catch all buffer.
for($i = 0; $i < $picture_x; $i += $square_pieces) {
$drawing_x = $i+$square_pieces;
for($j = 0; $j < $picture_y; $j += $square_pieces) {
$drawing_y = $j+$square_pieces;
$temp_pic = imagecreatetruecolor($drawing_x, $drawing_y);
$drawing_x_start = $i;
$drawing_y_start = $j;
//echo("Generating ".$drawing_x_start."[startX] and ".$drawing_x."[endX].. => ".$drawing_y_start."[startY] and ".$drawing_y."[stopY]<br>");
imagecopy($temp_pic, $image_handler, 0, 0, $drawing_x_start, $drawing_y_start, $drawing_x, $drawing_y);
imagejpeg($temp_pic,"puz/".$count.".jpg");
imagedestroy($temp_pic);
echo("<br><img src='puz/".$count.".jpg'>");
$count++;
}
}