Briefly looking at the script its labled where the output of the picture is.
you can set up a small database for the captions & make a call to it on matching the picture title to the correct caption
Im sure theres masses of ways of doing it but thats straight off the top of my head