I cannot see anything wrong with your code or any reason why this function will not work if you declare it in the view model. Also, I could not understand you completely. What do you mean by "it always performs a capture rather than a getPicture"? In your code I can see that you have both onCaptureImage which calls a capturePhoto function and onUploadPhoto that calls the getPhoto function. This is strange as getPicture() does not upload anything. Further, I don't know what these functions are bound to. If you want me to help you figure this out, please open a support ticket and send us your project, so that I can take a closer look.
I am looking forward to your reply.