Refactored addImage
Only add imageCaptions when imgCaption is present
Refactor generateGalleryExpando and generateImageExpando into a single
function