Fixes #7647: Added support for external registries

Please move into a separate method, it's more meaningful/reusable that way. Same for the method in auto_complete_image_tags