Use config instead of globals for ImageGallery