Im Looking for NSB expert here


#1

Hi Guys,

Anybody had done this feature in NSB?

Multiple Photo captured and save to mysql via webservice? Please contact me so that we can have a deal.


#2

mmmm I do not know if this helps. I just done the following:

In NSBASIC

  1. Enable the use of the camera with phonegap.
  2. Take a picture and put it into an image control (so the picture can be displayed)
  3. Convert that picture to Base64 (this means, in text format)
  4. Send it using AJAX to a php webservice that it is in the cloud

In PHP
5. Receive the information of the photo.
6. Convert it and save it as a png file

After that on another Webservice
In PHP Webservice (that should be called using AJAX from my nsbasic program)

  1. Convert the png file to base 64 (text file)
  2. Send the information to my nsbasic program

In NS Basic
3. Receive the text information.
4. Put that information in a SQLITE database (BLOB datatype)
5. Extract the information from the SQLITE
6. Using an image control display again the .png file with the base64 information.
*Step 4 and 5 can be skipped but I needed in my app to have some functionality. Keep in mind that the SQLITE database is just a temporary database which will hold only a couple of photos, so I can expend extra space storing the information in a BLOB datatype.

I haven’t done for multiple photos at the same time, but I think it is just a matter of a loop, and perhaps a little bit of patience depending of the size of the photo, which by the way, using the phonegap plugin, you can setup the percentage of the quality of the photo (100%, 75%, 50%, etc) depending the use you want to give to the photo, but I can tell you that I have them on 30% and looks acceptable.

One more thing… If you see in the cloud, I store the photo as a PNG file, and not on mySQL database. The main reason is a storage size… let me explain myself. In order to store an image you should need to have a BLOB field, or a MediumBLOB or a LONGBLOB. The firstone allows to store only 64 kb, the second one 16MB, and the third one 4GB. The things is that if you take pictures for example of 700kb, the blob would not work and you should use the mediumblob. This will use 16MB no matter if you technically use only 700kb, therefore you will be wasting a lot of usable space (if you convert the base64 to png or jpg this would not happen). Also, most of the webhostings can give you 20,30,50,100,500 GB of space (depending of the plan that you have), and perhaps unlimited databases, but with a space limit of 1GB. This can be a limit if you want to grow your project.


#3

Thanks for the follow up - sounds good!