Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Show a photo in Display
Started by jjrey95 Apr 24 2019 12:50 PM

3 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jjrey95

[GLOBAL: userInfoPane.html]
jjrey95
  • Observer

  • 24 posts
  • Corona SDK

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.



[TOPIC: post.html]
#2

dodi_games

[GLOBAL: userInfoPane.html]
dodi_games
  • Contributor

  • 370 posts
  • Corona SDK

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



[TOPIC: post.html]
#3

yosu

[GLOBAL: userInfoPane.html]
yosu
  • Contributor

  • 520 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

jjrey95

[GLOBAL: userInfoPane.html]
jjrey95
  • Observer

  • 24 posts
  • Corona SDK

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




[topic_controls]
[/topic_controls]