I’m creating a CRUD mobile application that includes taking a picture using the device’s camera and store that one on system.DocumentsDirectory and retrieve it for display. I know how to use sqlite in corona and use the media.show() to take pictures from the device’s camera, what I don’t know is how to save that picture in the system.DocumentsDirectory and retrieve it to display later. Can anyone help me?
Hi @wwwdotphilip,
Did you follow the API documentation for “media.show()” ? The third parameter (file) is the directory where you want to save the photo to.
http://docs.coronalabs.com/api/library/media/show.html
Also, did you inspect the sample project for this in your local application folder?
Corona SDK > SampleCode > Media > Camera
Hope this helps,
Brent
Sorry did not notice that. Then how do i retrieve the image file? Should I do it like this? display.newImage(“image.png”, left, top) or should I specify the image directory if I saved it in the system.DocumentsDirectory like “system.DocumentsDirectory/image.png”? And if I what to delete that file how do I do that? Thanks.
Finally got it working. To use the image from system.DocumentsDirectory I just input this code.
[lua]local image = display.newImage(“image.png”, system.DocumentsDirectory, 20, 20);[/lua]
And to delete the file I just based it from here
Hi @wwwdotphilip,
Did you follow the API documentation for “media.show()” ? The third parameter (file) is the directory where you want to save the photo to.
http://docs.coronalabs.com/api/library/media/show.html
Also, did you inspect the sample project for this in your local application folder?
Corona SDK > SampleCode > Media > Camera
Hope this helps,
Brent
Sorry did not notice that. Then how do i retrieve the image file? Should I do it like this? display.newImage(“image.png”, left, top) or should I specify the image directory if I saved it in the system.DocumentsDirectory like “system.DocumentsDirectory/image.png”? And if I what to delete that file how do I do that? Thanks.
Finally got it working. To use the image from system.DocumentsDirectory I just input this code.
[lua]local image = display.newImage(“image.png”, system.DocumentsDirectory, 20, 20);[/lua]
And to delete the file I just based it from here