0

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.
Usman Irshad
  • 37
  • 1
  • 8
  • As you see yourself, this is not a question, but a collection of questions. Please ask single questions with a very specific focus on StackOverflow. – EluciusFTW Dec 20 '16 at 14:50
  • @EluciusFTW : ok I will re-post it with All the Details Again. and With specific things. Thanks :) – Usman Irshad Dec 20 '16 at 14:59

2 Answers2

0

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Shekhar Tyagi
  • 1,644
  • 13
  • 18
0
  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.

backpackcoder
  • 327
  • 1
  • 7
  • Thanks alot for your answer. Its really Helpful. – Usman Irshad Dec 21 '16 at 10:21
  • I already have a Web Application on PHP which will have the UI using AngularJS to get the Image Processed Data from the REST API. Frontend (AngularJS) will request the REST API to get Image data with Queries, REST API will get the Image Data (BLOB), Do Image Processing and will return the Image. I am not getting that how would I generate the URL to send the images back to the Client Side? Should I render the Image and then send it to the Client Side or Should I get the Data to the Client Side and then Render the Image on the Browser? – Usman Irshad Dec 21 '16 at 10:30
  • You would have a PHP page dedicated to doing the image processing and then sending the image to the client just as if the client had requested an image normally. So if you had a php page image.php it could take the mongodb record id as a parameter. The client would see the `src` atttribute on an `` tag to `image.php?id=` and the image.php page would return the binary image data. Similar to this example (http://stackoverflow.com/questions/900207/return-a-php-page-as-an-image) – backpackcoder Dec 22 '16 at 19:26