Thread:Project:Support desk/Synchronize categories between pages

I'd like to make a template that keeps an article in the same category as an another specific article, and use this template as a kind of Category Sinchronizer for image files. For instance, say page 'Gandalf' has next two category: Magician, Fellowship of the Ring. And someone comes to add another one 'Ian McKellen'. I want to make all pictures within 'Gandalf' follow that category change, by adding a template like.

But I am quite lost in the making process, I can't figure out where to begin and how to develop. Please leave me your idea or suggestion, it would be greatly appreciated.