Custom meta boxes not saving

You are accessing the $_POST array in a wrong way. This is not possible:

$_POST['imagefields[' . $i . '][image2]']

Correct way would be:

$_POST['imagefields'][$i]['image2'];

(You have the same mistake when accessing the $values array.)

Also you are supposed to give the complete array to the update_post_meta() function instead of saving each value seperately:

 if(isset($_POST['imagefields'])) {
    update_post_meta($post_id, 'imagefields', $_POST['imagefields']);
}

*EDIT*

You can see if the values where saved to post_meta correctly using this code:

$values = get_post_custom($post->ID);
var_dump($values);

To fix the $values part you need to change all occurences of:

$values['imagefields[' . $i . '][image1]']

To:

$values['imagefields'][$i]['image1']