How to modify the get_batches generator to provide labels for Regression

i hope i may pickup this thread with an ongoing question.

i want to use flow_from_directory() to save the images inside a numpy array. i wanted to write my own function based on Jeremys lesson 2 notebook, but i cant get it to work. i tried this:

itr = gen.flow_from_directory('data/train/', batch_size=1, target_size=(32,32))
imgs = np.concatenate([itr.next() for i in range(itr.nb_sample)])

which (to me) looks like the same logic thats used in the get_batches() and get_data() functions. however it results in:

ValueError: could not broadcast input array from shape (32,32,3) into shape (1)

any ideas whats happening?