Added caption handling for image galleries