How to use display.capture and display.save??

Hi,

I took the sample from Corona where they take a picture with the camera and modified it with using the display.capture and save. It lets me take a picture with the camera but then it just shows the captured picture. After the display.save line I have a showAlert which does not come up. Why is this? How can I use this to take a picture, save it and then continue on?

I must have the events wrong or something because no matter what method I use for trying to save an image the app never continues. I really need some help and am at the point to pay for this if you can help me.

Thanks!

Warren

--   
-- Abstract: Camera sample app  
--   
-- Version: 1.2  
--   
-- Updated: September 21, 2011  
--  
-- Update History:  
-- v1.1 Fixed logic problem where it said "session was cancelled".  
-- v1.2 Added Android support.  
--  
-- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license  
-- Copyright (C) 2011 Corona Labs Inc. All Rights Reserved.  
---------------------------------------------------------------------------------------  
-- Camera not supported on simulator.   
local isXcodeSimulator = "iPhone Simulator" == system.getInfo("model")  
if (isXcodeSimulator) then  
 local alert = native.showAlert( "Information", "Camera API not available on iOS Simulator.", { "OK"})   
end  
  
--  
local bkgd = display.newRect( 0, 0, display.contentWidth, display.contentHeight )  
bkgd:setFillColor( 128, 0, 0 )  
  
local text = display.newText( "Tap anywhere to launch Camera", 0, 0, nil, 16 )  
text:setTextColor( 255, 255, 255 )  
text.x = 0.5 \* display.contentWidth  
text.y = 0.5 \* display.contentHeight  
  
local function captureWithDelay()  
 local capture = display.capture()  
 display.save(capture,"picture3.jpg",system.TemporaryDirectory)  
 native.showAlert("Corona", "Saved???")  
end  
  
local sessionComplete = function(event)   
 local image = event.target  
  
 print( "Camera ", ( image and "returned an image" ) or "session was cancelled" )  
 print( "event name: " .. event.name )  
 print( "target: " .. tostring( image ) )  
  
 if image then  
 -- center image on screen  
 image.x = display.contentWidth/2  
 image.y = display.contentHeight/2  
 local w = image.width  
 local h = image.height  
 print( "w,h = ".. w .."," .. h )  
 timer.performWithDelay( 100, captureWithDelay )  
 end  
end  
  
local listener = function( event )  
 if media.hasSource( media.Camera ) then  
 media.show( media.Camera, sessionComplete )  
 else  
 native.showAlert("Corona", "Camera not found.")  
 end  
 return true  
end  
bkgd:addEventListener( "tap", listener )  

[import]uid: 184193 topic_id: 32742 reply_id: 332742[/import]

Does anyone know this? Anytime I ask a question about the app stopping when I save an image or how to do this no one knows the answer. I want to subscribe to Corona but won’t if I don’t see this working in the trial version. i have offered to pay for this knowledge also but again no one knows. How do you get an answer from someone that knows answers? Does Corona rely only on other users to answer questions? If so, it’s not helping. Sorry if I sound a little upset but I have been trying for over a week to get this answer in different posts and threads and nothing so far.

Thanks
[import]uid: 184193 topic_id: 32742 reply_id: 130175[/import]

Does anyone know this? Anytime I ask a question about the app stopping when I save an image or how to do this no one knows the answer. I want to subscribe to Corona but won’t if I don’t see this working in the trial version. i have offered to pay for this knowledge also but again no one knows. How do you get an answer from someone that knows answers? Does Corona rely only on other users to answer questions? If so, it’s not helping. Sorry if I sound a little upset but I have been trying for over a week to get this answer in different posts and threads and nothing so far.

Thanks
[import]uid: 184193 topic_id: 32742 reply_id: 130175[/import]

Hey Warren, to address some of your points-

We do provide a LOT of help in the forum as a team, although naturally we have to give priority to subscribers when things are busy. This doesn’t mean that we don’t help trial users, we do, (the majority of my own time is actually spent on this,) however there are times you will not receive immediate help.

That said, we do also provide premium support, a service which is for users with urgent issues they require help from a member(s) of the team on.

Part of why you may be struggling to get answers is flooding; bumping more often than once every 24 hours, creating multiple threads about the same thing and/or posting in other topics on the same issue tends to irritate other users and make them less inclined to help you, mostly because in doing this you make it much harder to find answers in the future unless you go and update all of your dupe threads. (That said bumping more often than once a day and creating dupes are against our guidelines - we aim to keep a clean forum.)

A search will lead you directly to this thread, which explains how to do this; http://developer.coronalabs.com/forum/2012/02/12/saving-camera-picture

I hope the above is helpful and will be useful in the future when seeking assistance from others :slight_smile: [import]uid: 52491 topic_id: 32742 reply_id: 130197[/import]

Hey Warren, to address some of your points-

We do provide a LOT of help in the forum as a team, although naturally we have to give priority to subscribers when things are busy. This doesn’t mean that we don’t help trial users, we do, (the majority of my own time is actually spent on this,) however there are times you will not receive immediate help.

That said, we do also provide premium support, a service which is for users with urgent issues they require help from a member(s) of the team on.

Part of why you may be struggling to get answers is flooding; bumping more often than once every 24 hours, creating multiple threads about the same thing and/or posting in other topics on the same issue tends to irritate other users and make them less inclined to help you, mostly because in doing this you make it much harder to find answers in the future unless you go and update all of your dupe threads. (That said bumping more often than once a day and creating dupes are against our guidelines - we aim to keep a clean forum.)

A search will lead you directly to this thread, which explains how to do this; http://developer.coronalabs.com/forum/2012/02/12/saving-camera-picture

I hope the above is helpful and will be useful in the future when seeking assistance from others :slight_smile: [import]uid: 52491 topic_id: 32742 reply_id: 130197[/import]

I thought this Kickstarter project was beyond cool. These brothers are building a 3D flight simulator using a robot ball as the controller. It appears that its for the iPad and iPhone. I think this is a very unique idea and I want to try their app! http://www.kickstarter.com/projects/858730843/sphero-glide [import]uid: 193761 topic_id: 32742 reply_id: 130216[/import]

I thought this Kickstarter project was beyond cool. These brothers are building a 3D flight simulator using a robot ball as the controller. It appears that its for the iPad and iPhone. I think this is a very unique idea and I want to try their app! http://www.kickstarter.com/projects/858730843/sphero-glide [import]uid: 193761 topic_id: 32742 reply_id: 130216[/import]