Is there a way to open the device gallery like when clicking on an input of type file and select the picture just taked with the device camera?
My problem is that I already have an file input, but now when I click on it I open the camera to take a picture. Is it possible to open the device gallery after taking the picture to select the picture I just taken for uploading it?
Now I'm getting it on base 64 encoded. I don't wan't that, because I already have an php and ajax upload where I already use normal images.
My code:
$(document).ready(function(){
$('#file_input').on('click', function(e){
e.preventDefault();
navigator.camera.getPicture(onSuccess, onFail, {
quality: 100,
destinationType: Camera.DestinationType.DATA_URL
});
function onSuccess(imageData) {
// here I can upload imageData to the server
}
function onFail(message) {
alert('Failed because: ' + message);
}
});
})
Or is there a way to get the photo just taken just like when I have a file input and select from gallery?
EDIT:
I've found another solution to my problem without having to open the gallery after taking the picture.
I get the image like now, in base64 format. I pass it to PHP using AJAX and then I'm decoding it using base64_decode()
, and then a save it to the server using file_get_contents()
, after that a pretty basic save path to the database. And that's it. Success.
Although I can't seem too find the photo taken on my device. Has anyone an idea where it could be stored. Or I have to store it manually after taking the picture?