Well, by the sounds of things the generation of said thumbnails could create for a very slow site would it not???
Unless of course you have lightning fast code... of course

think people could also get annoyed waiting for these thumbnails to generate.
How about you generate the thumbnails once for each separate gallery section, but then after a while of no activity in each section have the site delete them from that unpopular section to save storage space, then, when the next person visits that section it generates them again??? this would then only ever happen once in a blue moon.....
Just a thought.. let me know if you need further clarification.