Use imagesLoaded plugin to detect image loading

Use the imagesLoaded jQuery plugin to detect when images are being
loaded to trigger our handler to resize the image containers and
captions.

Closes #622