Problem Inserting Image from Camera- corona bug?

I’m playing around with the corona sample apps and decided to try combining two together: the camera app and the ragdoll app. I’m trying to replace the rectangular head in the ragdoll app with:

local head = display.newImage(“self.jpg”, system.DocumentsDirectory, startX, startY)–display.newCircle( startX, startY, 12.5 )

    --head.fill = { type=“image”, filename=“self.jpg”, baseDir = system.TemporaryDirectory }

    --head.x = startX

    --head.y = startY

    --setFill(head, colorTable)

    ragdoll:insert (head)

However, nothing changes! I feel like there’s something small I’m missing and I’d really appreciate some assistance! If it helps, here’s my code: https://github.com/sw5813/ragdollifyyourself

I tested your code in the MAC and the head of the ragdoll is the photo. (Although the photo appears duplicated: one as the ragdoll head and another centered on the screen)

Hmm really? Do you have any suggestions as to how I can get it to show up too? When I tried running it on different Corona Simulator devices, as well as built it for my Android phone and installed the apk file, it didn’t work!

Are you using Mac or Windows?

Mac

That is strange. But try these two things:

  1. Update your function to capture image from camera. The “media.show( media.Camera, sessionComplete )”  is deprecated. Use media.capturePhoto() (docs link here)

  2. move the “timer.performWithDelay( 1000, onCameraImageCapture )” to be after the “display.save( thumb, “self.jpg”, system.DocumentsDirectory )”. You also don’t need that much wait (1000ms). (Actually you don’t need to have any wait at all)

Alright I tried making the edits that you suggested but it still doesn’t work :confused: I pushed my edits up to github and took a screenshot of what it looks like when I run it:

https://github.com/sw5813/ragdollifyyourself/blob/master/Screen%20Shot%202014-01-01%20at%2011.24.16%20PM.png

You need to turn off the debug mode to see the image. Just remove or comment the line “physics.setDrawMode( ‘debug’ )”

Thank you so much- IT WORKED! I’ve been scratching my head about this for a while now- I really appreciate it!

Although now I have a new problem- the image shows up on my simulator but not on my Android device! I removed the static picture of the head (newest version pushed up to github), which did show up on android, but the one that’s supposed to be the head isn’t there…

Did you set up the android permissions (for allow camera access) correctly?

Is this the correct method? https://github.com/sw5813/ragdollifyyourself/blob/master/build.settings

I tested your code in the MAC and the head of the ragdoll is the photo. (Although the photo appears duplicated: one as the ragdoll head and another centered on the screen)

Hmm really? Do you have any suggestions as to how I can get it to show up too? When I tried running it on different Corona Simulator devices, as well as built it for my Android phone and installed the apk file, it didn’t work!

Are you using Mac or Windows?

Mac

That is strange. But try these two things:

  1. Update your function to capture image from camera. The “media.show( media.Camera, sessionComplete )”  is deprecated. Use media.capturePhoto() (docs link here)

  2. move the “timer.performWithDelay( 1000, onCameraImageCapture )” to be after the “display.save( thumb, “self.jpg”, system.DocumentsDirectory )”. You also don’t need that much wait (1000ms). (Actually you don’t need to have any wait at all)

Alright I tried making the edits that you suggested but it still doesn’t work :confused: I pushed my edits up to github and took a screenshot of what it looks like when I run it:

https://github.com/sw5813/ragdollifyyourself/blob/master/Screen%20Shot%202014-01-01%20at%2011.24.16%20PM.png

You need to turn off the debug mode to see the image. Just remove or comment the line “physics.setDrawMode( ‘debug’ )”

Thank you so much- IT WORKED! I’ve been scratching my head about this for a while now- I really appreciate it!