def METHOD_NAME(fmt_string, file_path, target_directory, repo_id):
    # remove leading folders
    relative_path = file_path.replace(os.path.normpath(target_directory), '')
    # rename to an image
    relative_path = os.path.splitext(relative_path)[0] + '.png'
    # ensure that windows doesn't mess up anything
    slash_path = relative_path.replace('\\', '/')
    # uri encode
    url_encoded_path = urllib.parse.quote_plus(slash_path)
    return fmt_string.format(repo_id, url_encoded_path)