data_fetch("id", "SELECT LAST_INSERT_ID() AS `id`");
            $upload_file = "tattoo" . $id_data['id'] . ".png";
            $image_src = imagecreatefrompng($_FILES['upload_file']['tmp_name']);
            imagecopyresized($image_dest, $image_src, 0, 0, 0, 0, $image_width, $image_height, $upload_fileinfo[0], $upload_fileinfo[1]);
            imagepng($image_dest, $upload_dir . $upload_file);
            break;
        default:
            header("Location: http://" . $_SERVER['HTTP_HOST'] . "/Members/admin/image.construct.tattoo1.php?error=1");
            exit;
    }
    imagedestroy($image_src);
    imagedestroy($image_dest);
    // create preview
    image_preview($id_data['id'], 15);
    header("Location: http://" . $_SERVER['HTTP_HOST'] . "/Members/admin/image.construct.tattoo2.php?id=" . $id_data['id']);
    exit;
} elseif ($_GET['step'] == 2) {
    // update database
    mysql_query("UPDATE `subrosian_tattoos` SET `x`=" . $_POST['tattoo_x'] . ", `y`=" . $_POST['tattoo_y'] . ", `scale`=" . $_POST['tattoo_scale'] . ", `rotation`=" . $_POST['tattoo_rotation'] . ", `strength`=" . $_POST['tattoo_strength'] . " WHERE `id`=" . $_GET['id']);
    // create preview
    image_preview($_GET['id']);
    header("Location: http://" . $_SERVER['HTTP_HOST'] . "/Members/admin/image.construct.tattoo2.php?id=" . $_GET['id']);
    exit;
} elseif ($_GET['step'] == 3) {
    // finalize tattoo
    mysql_query("UPDATE `subrosian_tattoos` SET `ready`=1 WHERE `id`=" . $_GET['id']);
    // create thumbnail
    image_thumbnail($_GET['id']);
    header("Location: http://" . $_SERVER['HTTP_HOST'] . "/Members/admin/image.messages.php?id=3");
    exit;
}
        print "<input type=\"hidden\" name=\"user2\" value=\"{$user2}\">";
        print "<input type=\"hidden\" name=\"user3\" value=\"{$user3}\">";
        print "<input type=\"hidden\" name=\"user4\" value=\"{$user4}\">";
        print "<input type=\"hidden\" name=\"event\" value=\"{$event}\">";
        print "<input type=\"hidden\" name=\"transitory_image_path\" value=\"{$path_to_primary_image}\">";
        print "<input type=\"hidden\" name=\"file_name\" value=\"{$transitory_file_name}\">";
        print "<p>{$lang_image_processor_php['finished_manipulation']}</p>";
        print "<br>";
        print "<input type=\"submit\" value=\"{$lang_image_processor_php['finished_manipulation_button']}\">";
        print "</form>";
        pagefooter();
    } else {
        // The user desires to rotate the image.
        // We use the rotate image function.
        rotate_image($path_to_primary_image, $degrees);
        // Get width and height here.
        $source_image_size_and_type = getimagesize($path_to_primary_image) or die($lang_image_processor_php['file_corrupt']);
        $source_image_width = $source_image_size_and_type[0];
        $source_image_height = $source_image_size_and_type[1];
        $source_image_type = $source_image_size_and_type[2];
        // Now we have to create the preview thumbnail.
        // The file has been rotated in the transitory directory. At this point, we
        // are ready to create the form that will allow the user to rotate the image.
        // It requires a preview thumbnail to be loaded. We will use the image_preview
        // function.
        $path_to_preview_image = image_preview($path_to_primary_image, $maximum_width);
        // Our preview thumbnail is now on the server. Let's create the
        // rotation form.
        make_form($_SERVER[PHP_SELF], $path_to_preview_image, $path_to_primary_image, $transitory_file_name);
    }
}