Show a photo in Display

Good afternoon,

I have a question regarding access to the camera and the photo gallery, I know there are forums and information that exists on this subject. I can currently choose between taking the photo or just accessing the camera, but I can not do that by pressing a button, the option to take a photo or access the gallery appears. In the same way when I bring the image of the gallery and show it on the screen, I save it in baseDir = system.DocumentsDirectory but in the same way I need to save that photograph in a database and I do not know how to do it, I do not know if you can take the address where the photograph is saved and send it to the database. Besides this in the simulator it works very well at the moment of saving and showing the photo on the screen, but when it comes to testing on an Android device, it does not let me insert the photo, select it but never show it, in ios if it works normal.

I would really appreciate if you can help me.

Hi! 

Without any code is difficult to help but what I can interpret what I am reading is that you must first check if the file exists and then save it where you want … I do not have time now to see where are the api but you should “search/take a look” for the function doesFileExist() and display.save () of Corona tutorials and documents.

DoDi

You can check out these in the API document. A good place to start is here @ https://docs.coronalabs.com/api/library/media/hasSource.html

  • Select photo from device-gallery : ‘media.selectPhoto()’
  • Capture photo using device camera : ‘media.capturePhoto()’

You will need the filename & folder (e.g. system.TemporaryDirectory) to use the selected photo-file.

To send the photo to database, i would suggest a http-post call. See ‘network.upload()’ 

Hope it helps.

is that with network.upload can I save the photo in the database as such? Or would I just save this url?

Hi! 

Without any code is difficult to help but what I can interpret what I am reading is that you must first check if the file exists and then save it where you want … I do not have time now to see where are the api but you should “search/take a look” for the function doesFileExist() and display.save () of Corona tutorials and documents.

DoDi

You can check out these in the API document. A good place to start is here @ https://docs.coronalabs.com/api/library/media/hasSource.html

  • Select photo from device-gallery : ‘media.selectPhoto()’
  • Capture photo using device camera : ‘media.capturePhoto()’

You will need the filename & folder (e.g. system.TemporaryDirectory) to use the selected photo-file.

To send the photo to database, i would suggest a http-post call. See ‘network.upload()’ 

Hope it helps.

is that with network.upload can I save the photo in the database as such? Or would I just save this url?