Camera save location
I need to be able to specify where the camera component saves a new photo and would also need to create a new directory for this. Is this possible?
Thanks
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
I need to be able to specify where the camera component saves a new photo and would also need to create a new directory for this. Is this possible?
Thanks
Hi Dan,
Tiggzi uses Cordova - this is a set of device APIs that allow a mobile app developer to access native device function from JavaScript.
CameraService has a request parameter named "destinationType".
If it's value = "File URI" then device saves image file automatically, by it's default.
If you set value = "Data URL" - then service woud return encoded image, just a bit line. You'll be able to process it via JavaScript.
You can check where the pictures saved. Set Camera type to URL, for the Camera on Success event Run Custom JS:codealert(arguments[0].imageURI); /codeAfter invoking Camera on device you should get an alert with the image location. You can save that image into the local storage and then access that image.
Hi,
When I try this suggestion I just get a msg of undefined returned, any ideas why that might be?
Thanks
This works for me, just call movePic on the CameraService Success event:
var IName = "";
var FName = "";
function movePic(imageUrl, imagename)
{
IName = imagename;
window.resolveLocalFileSystemURI(imageUrl, resOnSuccess, resOnError);
}
function resOnSuccess(entry)
{
FName = entry.name;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function(fileSys) {
fileSys.root.getDirectory("MyPhotos", {create: true, exclusive: false},
FolderSuccess, resOnError);
}, resOnError);
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function(fileSys) {
fileSys.root.getDirectory("MyPhotos/" + IName, {create: true, exclusive: false},
function(directory) {
entry.copyTo(directory, IName + "-" + FName, success, resOnError);
}, resOnError);
}, resOnError);
}
function resOnSuccess2(entry)
{
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function(fileSys) {
fileSys.root.getDirectory("MyPhotos/" + IName, {create: true, exclusive: false},
function(directory) {
entry.copyTo(directory, IName + "-" + FName, success, resOnError);
}, resOnError);
}, resOnError);
}
function resOnError(error)
{
alert(error.code);
}
function success(entry)
{
alert("Photo saved to: " + entry.fullPath);
}
function FolderSuccess(entry)
{
}
Hmmm, dont seem to have success with that either, when the comment above says setting destination type my value seems to be fixed at Data URL and it is disabled so there is not way to change it. Is this normal?
Thanks
Go to EditMapping and change it in there to File URI
It is greyed out, when the cursor goes over it, it has a sort of no entry sign (red circle with a line through)
Are you clicking on "Edit Mapping" or just clicking the CameraService link?
Hmm I see what the problem is there, I had the destination type already mapped but the link/mapping line doesn't show up in Chrome, reloaded in Firefox and the mapping link shows.
Hi,
Yes, this is a known problem, will be fixed soon.