Page 1 of 3

Camera save location

Posted: Thu Feb 21, 2013 9:49 am
by Dan Sweeney

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


Camera save location

Posted: Thu Feb 21, 2013 10:46 am
by Kateryna Grynko

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.


Camera save location

Posted: Fri Apr 12, 2013 1:42 pm
by pafowkes

Hi,

When I try this suggestion I just get a msg of undefined returned, any ideas why that might be?

Thanks


Camera save location

Posted: Fri Apr 12, 2013 2:01 pm
by Dan Sweeney

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)
{
}


Camera save location

Posted: Fri Apr 12, 2013 2:30 pm
by pafowkes

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


Camera save location

Posted: Fri Apr 12, 2013 2:40 pm
by Dan Sweeney

Go to EditMapping and change it in there to File URI


Camera save location

Posted: Fri Apr 12, 2013 2:51 pm
by pafowkes

It is greyed out, when the cursor goes over it, it has a sort of no entry sign (red circle with a line through)


Camera save location

Posted: Fri Apr 12, 2013 3:05 pm
by Dan Sweeney

Are you clicking on "Edit Mapping" or just clicking the CameraService link?


Camera save location

Posted: Fri Apr 12, 2013 3:15 pm
by pafowkes

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.


Camera save location

Posted: Fri Apr 12, 2013 3:17 pm
by Kateryna Grynko

Hi,
Yes, this is a known problem, will be fixed soon.