def METHOD_NAME(self, user_id, domain_id):
    with app.app_context():
        images = list(
            r.table("domains")
            .get_all(user_id, index="user")
            .pluck("image")
            .distinct()
            .run(db.conn)
        )
        proposed_img_exists = (
            r.table("domains")
            .get_all(domain_id + ".jpg", index="image_id")
            .count()
            .run(db.conn)
        )
    if domain_id:
        proposed_img = [self.get_card(domain_id + ".jpg", "user")]
        if not proposed_img_exists:
            with app.app_context():
                domain_name = (
                    r.table("domains")
                    .get(domain_id)
                    .pluck("name")
                    .run(db.conn)["name"]
                )
            img = gen_img_from_name(domain_name)
            img.save(os.path.join(app.USERS_CARDS, domain_id + ".jpg"))
    else:
        proposed_img = []
    return proposed_img + [
        image["image"]
        for image in images
        if image.get("image")
        and image["image"]["type"] == "user"
        and not image["image"]["id"].startswith("_")
    ]