cannot save photos with specified name

I am encountering an issue that all photos were taken by my Corona app always show same file name as "picture1, picture2, picture3 … etc ", while In my code the image name should be “image.jpg”

I’ve been googling as well as seeking help from corona labs, now I am completely stuck. 

local function onComplete ( event ) local photo = event.target local photoGroup = display.newGroup() photoGroup:insert(photo) local temDirecoty = system.TemporaryDirectory display.save(photoGroup, "image.jpg", temDirecoty) end local function handleButtonEvent2 ( event ) media.capturePhoto({ listener = onComplete --[[destination = { baseDir=system.TemporaryDirectory, filename="image.jpg", type="image" }]]-- }) end

Can anyone help me out of this? Thank you for any instruction

Lines 14-17 are commented out.

Delete line 13 completely, and remove the ]]-- from the end of line 17.

[edit]

Oh, and you need to add a comma to the end of line 12.

Hi Appletreeman, I changed my code as you pointed and then I built the Android app and install it on android emulator. However, it seems it still not working… I got a file name called picture5 this time… 

I realized all the photos taken by my Corona app were saved in a folder called “picture”, I did not specify this folder in my code tho. Why did this happen?

Can you post the complete file snippet with proper formatting?

Sure,

local composer = require( "composer" ) local scene = composer.newScene() local widget = require("widget") local storeDirectory = system.DocumentsDirectory local function onComplete ( event ) local photo = event.target local photoGroup = display.newGroup() photoGroup:insert(photo) display.save(photoGroup, "image.jpg", storeDirectory) end function scene:create( event ) local sceneGroup = self.view params = event.params local function handleButtonEvent2 ( event ) media.capturePhoto( {listener = onComplete,baseDir=storeDirectory,filename="image.jpg",type="image" }) end local button2 = widget.newButton( -- open camera button { width = 80, height = 80, defaultFile = "icons8-Camera Filled-100.png", id = "2", onRelease = handleButtonEvent2 } button2.x = display.contentCenterX button2.y = display.contentCenterY sceneGroup:insert( button2 ) end end ......

Thank you for any comment

Lines 14-17 are commented out.

Delete line 13 completely, and remove the ]]-- from the end of line 17.

[edit]

Oh, and you need to add a comma to the end of line 12.

Hi Appletreeman, I changed my code as you pointed and then I built the Android app and install it on android emulator. However, it seems it still not working… I got a file name called picture5 this time… 

I realized all the photos taken by my Corona app were saved in a folder called “picture”, I did not specify this folder in my code tho. Why did this happen?

Can you post the complete file snippet with proper formatting?

Sure,

local composer = require( "composer" ) local scene = composer.newScene() local widget = require("widget") local storeDirectory = system.DocumentsDirectory local function onComplete ( event ) local photo = event.target local photoGroup = display.newGroup() photoGroup:insert(photo) display.save(photoGroup, "image.jpg", storeDirectory) end function scene:create( event ) local sceneGroup = self.view params = event.params local function handleButtonEvent2 ( event ) media.capturePhoto( {listener = onComplete,baseDir=storeDirectory,filename="image.jpg",type="image" }) end local button2 = widget.newButton( -- open camera button { width = 80, height = 80, defaultFile = "icons8-Camera Filled-100.png", id = "2", onRelease = handleButtonEvent2 } button2.x = display.contentCenterX button2.y = display.contentCenterY sceneGroup:insert( button2 ) end end ......

Thank you for any comment