Page 1 of 1

save camera image to phone gallery and set name

Posted: Thu Nov 05, 2015 7:53 pm
by David wyatt

Hi,

I've read lots of topics and tutorials but still cant find how to use the camera to name and save image to gallery.

Ive successfully saved the image to the apps route folder and used the url to show in an image component. But I need the image in the phones gallery so that the user can find it

thanks for your help

Dave


save camera image to phone gallery and set name

Posted: Thu Nov 05, 2015 9:27 pm
by Serhii Kulibaba

Hello David,

Camera component gets you a base64 image. You can save it into the gallery: http://stackoverflow.com/questions/29...


save camera image to phone gallery and set name

Posted: Fri Nov 06, 2015 5:46 pm
by David wyatt

Hi Sergiy,

Thank you for your help but im a little confused on how to use the code.

Ive added
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {

var fileTransfer = new FileTransfer();
var uri = encodeURI("http://www.example.com/image");
var path = fileSystem.root.toURL() + "appName/example.jpg";

fileTransfer.download(
uri,
path,
function(entry) {
refreshMedia.refresh(path); // Refresh the image gallery
},
function(error) {
console.log(error.source);
console.log(error.target);
console.log(error.code);
},
false,
{
headers: {
"Authorization": "dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
}
}
);

});

to my on camera service complete, setting uri as my local storage where ive saved my photo location and changed path to "DCIM/example.jpg" but I cant get it to work

thanks

Dave


save camera image to phone gallery and set name

Posted: Mon Nov 09, 2015 12:50 pm
by Serhii Kulibaba

Unfortunately custom JS code is something outside the scope of standard Appery.io platform support. You may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).


save camera image to phone gallery and set name

Posted: Mon Nov 09, 2015 1:18 pm
by David wyatt

Hi Sergiy,

Thank you, will look into it. Are Appery.io considering including this function at a later date as using the camera function to save to the gallery seems like a basic/fundamental requirement.

many thanks

Dave


save camera image to phone gallery and set name

Posted: Wed Nov 11, 2015 8:05 am
by Serhii Kulibaba

Please look at this basic tutorial: http://selinosblog.com/2014/01/27/sav...


save camera image to phone gallery and set name

Posted: Wed Nov 11, 2015 5:54 pm
by David wyatt

Hi Sergiy,

Thank you for your help but I've decide not to use the Appery.io camera service and call the plugin through javascript, that way the option to save to gallery is included.

If anyone else has the same issue use this

function capturePhoto() {

navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality : 90,
destinationType : Camera.DestinationType.FILE_URI, ///// same as appery.io /////
sourceType : Camera.PictureSourceType.CAMERA, ///// same as appery.io /////
allowEdit : false, ///// sends photo to phone edit e.g crop /////
encodingType: Camera.EncodingType.JPEG, ///// same as appery.io /////
targetWidth: 1024, ///// same as appery.io /////
targetHeight: 768, ///// same as appery.io /////
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: true }); ///// this saves image to camera gallery folder /////
}

and call the function on a button press

full details are here:
http://docs.phonegap.com/en/edge/cord...