I'm not 100% sure on how to get it to automatically do this yet, but I know what you're wanting.
A place where the affiliate enters there ID and it puts their affiliate code in the gallery
a PHP include will work, I'm just not sure how to do the above part yet...
