add script to dynamically resize captions in gallery