MongoDB - 用于图像的REST API架构

我在MONGODB的RAW BINARY DATA中有数千张图像(大小不到16MB)及其Meta 来自小卫星(BSON文档)的JSON中的数据,如日期,时间,位置等。 我必须制作REST API,它可以使用各自的元数据查询图像。 以下事项需要在观察之下进行。</ p>

数据= 数据截图 </ p>


  1. 用户将根据时间,地点等使用RestAPI查询元数据。</ li>
  2. 服务器将 从Cilent with Query和DO Image-Processing获取请求并返回图像</ li>
  3. 图像处理将在服务器端完成。</ li>
  4. 请求的图像将通过RESTAPI从 使用GET请求的服务器到客户端。</ li>
    </ ol>

    注意:只需查看附加图片即可获取数据的想法。</ em> </ strong> </ p>

    使用的工具:数据库= MongoDB </ p>

    问题</ strong> </ p>


    1. 哪种服务器端编程语言更可行? PHP,Python或Node.js?</ li>
    2. 在这种情况下我如何进行图像处理? 使用PHP,Python或Node.js上的库?</ li>
    3. 使用哪种技术为MongoDB制作REST API,最适合使用二进制数据和图像。</ li>
    4. 如何使用 图像将从服务器传输到客户端,即二进制数据。 然后在客户端渲染。</ li>
      </ ol>
      </ div>

展开原文

原文

I have thousands of Images (wihch are less then 16MB in size) in RAW BINARY DATA in MONGODB with its Meta-Data in JSON as Date, Time, Location etc from the Small Satellite (BSON Documents). I have to make REST API which can query the Images with its respective Meta-Data. Following things needs to be taken under observation.

Data = Data Screenshot

  1. User's will query the Meta-Data with RestAPI, based on time, location etc.
  2. Server will get the Request from Cilent with Query and DO Image-Processing and Returns the Images
  3. Image Processing will be done on Server Side.
  4. Requested Images will travel through RESTAPI from Server to Client with the GET Request.

NOTE : Just see the Attached Picture to Get the Idea of the DATA.

Tools Used : Data-Base = MongoDB

Questions

  1. Which Server Side Programming Language is More feasible? PHP, Python or Node.js?
  2. How I could do Image-Processing in this scenario? With Libraries on PHP, Python or Node.js?
  3. Which Technology to be Used for making REST API for MongoDB which is best with Binary Data and Images.
  4. How Images will travel from Server to client i-e In binary data. and then Renders at Client Side.

duanfengdian7014
duanfengdian7014 :好的,我会再次发布所有详细信息。和具体的事情。谢谢:)
3 年多之前 回复
dongliao6491
dongliao6491 如您所见,这不是一个问题,而是一系列问题。请专门针对StackOverflow提出单个问题。
3 年多之前 回复

2个回答

  1. NodeJS and Python are equally suited for basic image processing. I would make a server side language determination more on the expertise of your team and/or current environment in that regard.
  2. With Python PIL or Pillow is the primary image library to use. I've used https://github.com/aheckmann/gm for NodeJS which was not difficult to do basic image processing.
  3. (and 4) In terms of retrieving images from an API I typical using a typical REST/CRUD set up to get the metadata and put the image one level deeper using by adding .../image? to the endpoint. For example:

GET ../picture/<id>

Would return the picture metadata with the image url included.

GET ../picture/<id>/image?<processing params>

Would return the image itself.

If you are making a web application using the <img> tag and the correct image URL is sufficient for displaying the image.

I would also recommend storing the images on the filesystem directly (not in the database) unless you have a specific reason to store them in the database. It tends to simplify both you storage code and retrieval since you don't need to deal with sending a BLOB to the database. Nginx (https://www.nginx.com/resources/wiki/modules/upload/) for example lets you set file upload location so literally just need to get the filename from the headers and copy/rename it to the location you want to store the file permanently. This also lets you easily remap a URL to the location on the filesystem. The biggest benefit is that it lets the webserver worry about the upload and download and you just have keep track of the filename in your code.

douhandie6615
douhandie6615 您将拥有一个专门用于执行图像处理的PHP页面,然后将图像发送到客户端,就像客户端正常请求图像一样。 所以如果你有一个php页面image.php它可以将mongodb记录id作为参数。 客户端会看到src在<img>标签上附加到image.php?id = <在此处插入记录ID>,image.php页面将返回二进制图像数据。 与此示例类似(stackoverflow.com/questions/900207 / ...)
3 年多之前 回复
doukong5394
doukong5394 我已经在PHP上有一个Web应用程序,它将使用AngularJS来从REST API获取图像处理数据。 前端(AngularJS)将请求REST API使用查询获取图像数据,REST API将获取图像数据(BLOB),执行图像处理并将返回图像。 我没有得到如何生成将图像发送回客户端的URL? 我应该渲染图像然后将其发送到客户端还是应该将数据发送到客户端然后在浏览器上渲染图像?
3 年多之前 回复
du7999
du7999 非常感谢您的回答。 它确实有帮助。
3 年多之前 回复



根据你的问题,我会逐一给你答案。</ p>


    < li>

    nodejs更好,因为它们有超过15000个模块。</ p> </ li>

  1. 你可以使用像sharp,Jimp等更多的nodejs模块进行图像处理。 / p> </ li>

  2. MongoDB是一个面向文档的NoSQL数据库(大数据就绪)。 它以类似JSON的格式存储数据,并允许用户对其执行类似SQL的查询,而nodejs最适用于此目的。</ p> </ li>

  3. 为此目的有多少 从服务器到客户端的模块,如webcamjs。</ p> </ li>
    </ ol>
    </ div>

展开原文

原文

According to your questions, I will give you answer one by one.

  1. nodejs is better as they have more then 15000 modules.

  2. you can do image processing by using nodejs modules like sharp, Jimp and many more.

  3. MongoDB is a document-oriented NoSQL database (Big Data ready). It stores data in JSON-like format and allows users to perform SQL-like queries against it, and nodejs is best for this purpose.

  4. for this there are number of modules for travels from server to client, like webcamjs.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问