The first step would be to figure out how to include it in the slideshow for all of the images. Then you can work on the conditional portion.
I'm not sure why it would break your slideshow. What code are you using to do the slideshow? Most likely the solution is going to be to update that so that it supports adding what you need.