Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Take a photo and rename in the photo gallery
Started by ale931515 Jun 18 2019 09:09 AM

No replies to this topic
take a photo and rename
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ale931515

[GLOBAL: userInfoPane.html]
ale931515
  • Observer

  • 2 posts
  • Corona SDK

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.




[topic_controls]
[/topic_controls]