Take a photo and rename in the photo gallery

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( “pared.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=“pared.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 = “”,

and save the photo but with the name of Picture and the consecutive one.

Try the media.save()

http://docs.coronalabs.com/api/library/media/save.html

Try the media.save()

http://docs.coronalabs.com/api/library/media/save.html