First you'd have to change the engine so that it could handle calling portraits in dialogs. As if that weren't hard enough, each and every bit of dialog intended to have a portrait would have to be modified so that it knows to call a portrait, and which portrait to use. Furthermore, you couldn't possibly automate this process because often a character's name will appear in speech that's not his, because not all of any given character's speech has his name before it (such as the second line in the middle of a sentence), and because numerous characters use the same name both in the present and in Cloud's nibelheim flashback.
Basically, it would involve starting with something that we don't know how to do yet and finishing with hours upon hours of tedious "check, double check, cut, paste" work.