In 2.0 I can not do display a png image that is in system.DocumentsDirectory

I recently migrated my project to 2.0 (with build 2013.2100) and I have a problem, I can not do display a png image that is in system.DocumentsDirectory.
 

userPhoto= display.newImage( “myPhoto.png” , system.DocumentsDirectory ,0,0)

In both corona simulator on the PC than on the corona simulator on mac and also on iphone device while the image is displayed correctly only on Android devices, the png image is not displayed

In the previous build everything works fine, however with the 2.0 I have this big problem

Does anyone know the solution?

I apologize for my English

Flavio

Are you getting any errors in your console log? 

Do you really want the image centered at 0,0?

How is myPhoto.png getting into system.DocumentsDirectory?

If you need help finding/reading the console logs for the various devices/simulators please read: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Rob

You are probably making some code mistake, please share the entire code…

PS: Fala português?

I have no error message,

I did several tests but I can not solve
I changed the line from
 

userPhoto= display.newImage( “myPhoto.png” , system.DocumentsDirectory ,_W/2,_H/2)

to
 

userPhoto= display.newImage( “myPhoto.png” , _W/2,_H/2)

in this way works.

but since this file is to be saved I need that the file is in system.DocumentsDirectory
 

I’m Italian

How are you creating the myPhoto.png file? Are you copying from resource directory or saving a camera capture or something else?

saving camera but I’ve tried other PNG created with photoshop, and at least in ios devices work well. With sdk 1.0 works well on Android devices!

  1. Are you sure the camera is saving the file? You need to set an additional parameter in media.capturePhoto to save to a file like so:

media.capturePhoto( {listener = onComplete, destination = {baseDir=system.DocumentsDirectory, filename=“image.jpg”, type=“image”} } )

  1. Are you sure the file is saved as png and not jpg?

yes i make this tests

How about the extension? Are you confirming that it’s a case-sensitive match, i.e. not “.png” in one place and “.PNG” in another?

Brent

Is the first thing that I checked. You can test to load in the function scene:createScene( event ) a png image locate in system.ResourceDirectory on Android device with  build 2013.2100  ?

thanks

Did you mean system.DocumentsDirectory?

sorry DocumentsDirectory :slight_smile:

Are you getting any errors in your console log? 

Do you really want the image centered at 0,0?

How is myPhoto.png getting into system.DocumentsDirectory?

If you need help finding/reading the console logs for the various devices/simulators please read: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Rob

You are probably making some code mistake, please share the entire code…

PS: Fala português?

I have no error message,

I did several tests but I can not solve
I changed the line from
 

userPhoto= display.newImage( “myPhoto.png” , system.DocumentsDirectory ,_W/2,_H/2)

to
 

userPhoto= display.newImage( “myPhoto.png” , _W/2,_H/2)

in this way works.

but since this file is to be saved I need that the file is in system.DocumentsDirectory
 

I’m Italian

How are you creating the myPhoto.png file? Are you copying from resource directory or saving a camera capture or something else?

saving camera but I’ve tried other PNG created with photoshop, and at least in ios devices work well. With sdk 1.0 works well on Android devices!

  1. Are you sure the camera is saving the file? You need to set an additional parameter in media.capturePhoto to save to a file like so:

media.capturePhoto( {listener = onComplete, destination = {baseDir=system.DocumentsDirectory, filename=“image.jpg”, type=“image”} } )

  1. Are you sure the file is saved as png and not jpg?

yes i make this tests

How about the extension? Are you confirming that it’s a case-sensitive match, i.e. not “.png” in one place and “.PNG” in another?

Brent