dongpai6552 2016-12-20 14:46
浏览 105
已采纳

MongoDB - 用于图像的REST API架构

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.
  • 写回答

2条回答 默认 最新

  • doukao8851 2016-12-20 15:46
    关注
    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献