Group gallery images, prepare ajax update