Not sure of the details. Have you considered making the various Gallery types as items in their own database, then cross referencing using the MULTI-REFERENCE within the database that has all the individual images. Then create pages and add the Gallery type dataset to the pages, add a Gallery or a repeater that feeds it with images assigned with the multi-reference.
The latter part is what I am not sure will work because of the set up.