Would it be possible to generate the HTML template of the gallery with a thumbnail gallery and then open the images with ajax?