Only flatten images recursively if recursive checkbox is checked