- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use the camera plugin. I have found some code to access the photo library, and that does work and the selection screen comes up on the phone. My goal is to simply display a selected image on my page. Question I have is how do I get the path to the selected image (or a thumbnail of it) so I can assign to my img tag on my page?
Here is the code I am using. Is the FILE_URI the path to the selected image that I can use for my img element? Doesn't seem to work when I tried it.
var onPhotoSuccess = function(FILE_URI) { alert(FILE_URI); selectedImg.src = FILE_URI; }; var onPhotoFail = function(e) { alert("On fail " + e); } selectPhoto = function(){ var options= { quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI, sourceType: 0, // 0:Photo Library, 1=Camera, 2=Saved Photo Album encodingType: 0 // 0=JPG 1=PNG }; navigator.camera.getPicture(onPhotoSuccess,onPhotoFail,options); };
Ps: I am not finding any documentation on the plugin. The information button next to the plugin on the project properties pages goes to a 404 page - https://github.com/apache/cordova-plugin-camera/blob/master/doc/index.md.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update: found https://github.com/apache/cordova-plugin-camera which does show a sample for doing what I hoped to do - select an image and display in an img tag. I needed to use a document.getElementById call...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page