SUCCESS
Thanks for all your help.
I’ll try to write a very basic, just get picture from phone camera and post it at some stage for others that might be tearing there hair out in the future.
SUCCESS
Thanks for all your help.
I’ll try to write a very basic, just get picture from phone camera and post it at some stage for others that might be tearing there hair out in the future.
Spoke to soon.
Camera is now working when I call the TakePhoto() Function but I am then getting an error from the onPicutureReturned(ImageURI) function -> Cannot set property ‘src’ of null.
I’ve used remote debugging in Chrome. navigator.camera.getpicuture() is available, and obviously working, but ImageURI is undefined.
I’ll keep trying a few different things to see if I can sort it out, but any help appreciated if it’s something simple I’m missing.
Here is the code for dealing with the picture taking:
Function TakePhoto()
options={quality : 25, _
destinationType : 1, _
sourceType : 1, _
correctOrientation : True, _
saveToPhotoAlbum : False, _
allowEdit: False}
navigator.camera.getPicture(onPictureReturned, onPictureError, options)
End Function
Function onPictureReturned(ImageURI)
imgScore.firstChild.src=ImageURI
End Function
Function onPictureError(message)
MsgBox "Couldn't take picture because " & message
End Function
And here is what I see in the remote debugging:
Check imgScore.firstChild
. I bet there is nothing there, so setting its src
won’t work.
You’re correct.
I’ve changed it to imgScore.src and it now works fine.
One question, I got the original code for the onPictureReturned from: Using Cordova Plugins - NSB App Studio
Is the code in the link above wrong or am I missing something? A very quick look through the docs looks like maybe using imgScore.firstchild.src might be the Javascript version?
Thank you again. Might be able to go back to sleep now
You’re right - the Tech Note was incorrect. The sample (“PhoneGapCamera”) had it right.
We’ve fixed the Tech Note.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.