How can we save an image taken with the camera to the user’s phone, allowing it to be stored in the photo gallery and with a personalized name?
I could take the photo and I keep it in the system.DocumentsDirectory directory but when I want to see if it’s in the gallery I do not have it
local function onPhotoComplete( event )
if ( event.completed ) then
native.showAlert( “Corona”, "Well ", “OK” )
local myImage = display.newImage( “test.jpg”, system.DocumentsDirectory)
myImage:translate( 100, 100 )
myImage:setFillColor( 1, 0, 0 )
end
end
if ( media.hasSource( media.Camera ) ) then
media.capturePhoto( { listener=onPhotoComplete,
destination={
baseDir=system.DocumentsDirectory,
filename=“test.jpg” ,
type=“image”
}
} )
else
native.showAlert( “Corona”, “This device does not have a camera.”, “OK” )
end
Done the test leaving empty in baseDir
destination={
baseDir="",ir = “”,
and save the photo but with the name of Picture and the consecutive one.
and save the photo but with the name of Picture and the consecutive one.