Dan Sweeney
Posts: 0
Joined: Thu Feb 21, 2013 9:49 am

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Camera save location

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.

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Camera save location

Hi,

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

Thanks

Dan Sweeney
Posts: 0
Joined: Thu Feb 21, 2013 9:49 am

Camera save location

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

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Camera save location

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

Dan Sweeney
Posts: 0
Joined: Thu Feb 21, 2013 9:49 am

Camera save location

Go to EditMapping and change it in there to File URI

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Camera save location

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

Dan Sweeney
Posts: 0
Joined: Thu Feb 21, 2013 9:49 am

Camera save location

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

pafowkes
Posts: 0
Joined: Fri Apr 12, 2013 1:42 pm

Camera save location

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Camera save location

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

Return to “Issues”