0

我正在开发一个应用程序,我需要从 URLS 中检索图像(例如http://foo.com/bar.png)并将它们保存在 mongodb 中。该应用程序是使用 angularjs 构建的,并使用部署的 API 东西。这是图像集合的 config.js 文件:

{
    "type": "Collection",
    "properties": {
        "image": {
            "name": "image",
            "type": "image/png",
            "typeLabel": "image/png",
            "required": true,
            "id": "image",
            "order": 0
        }
    }
}

我尝试过搜索,但找不到任何图像和部署。我只需要一种简单的方法来从 URL 中检索图像,将它们保存在 mongodb 中,然后稍后再渲染它们。

4

1 回答 1

1

没有列类型image/pngAFAIK。我们可以使用字符串来代替它。为什么不将图像作为数据 uri插入?

{
    "type": "Collection",
    "properties": {
        "image": {
            "name": "image",
            "type": "string",
            "typeLabel": "string",
            "required": true,
            "id": "image",
            "order": 0
        }
    }
}
于 2015-11-18T05:16:17.113 回答