Custom DOM placement using AJAX
I suggest you first create a View of the image files with node id passed as Contextual Argument. Make it display the images in the order you want and then add this View as a field using Viewfield