store image names in array in javascript controller