I am creating a project where i take pictures and store them on device + show
them in lists. i have some issues because the photos taken are automatically
saved on the card in DCIM/Camera folder even though i don't do that.
this.cameraOptions = {
quality: 75,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
sourceType: this.camera.PictureSourceType.CAMERA,
mediaType: this.camera.MediaType.PICTURE,
saveToPhotoAlbum: false
}
this is the code for taking a photo and moving in either to dataDirectory or in
card app private folder:
public takePicture(){
return new Promise((resolve, reject) => {
let file_name='IMG_'+(Math.floor(Date.now() / 1000))+'.jpg';
let file_location=this.platform.is('android') ?
(this.helper.general_settings['store_external'] &&
this.helper.general_settings['externalDirectory'] ?
this.helper.general_settings['externalDirectory'] : this.file.dataDirectory) :
this.file.dataDirectory;
this.helper.showLoading();
this.camera.getPicture(this.cameraOptions).then((imageData) => {
let sourceDir=imageData.substring(0,imageData.lastIndexOf('/')
+1);
let
sourceFileName=imageData.substring(imageData.lastIndexOf('/')
+1,imageData.length);
this.file.moveFile(sourceDir,sourceFileName,file_location,file_name)
.then((fileDone:any) => {
resolve({'file_name':file_name,
'file_location':file_location });
}).catch(error => {
reject(error);
//console.log(error);
});
}, (err) => {
reject(err);
console.log(err);
});
});
}
the idea is that the same photo is saved automatically also on card DCIM/Camera
(outside the application on the system the base location of saving pictures is
on the memory card) - getPicture i know it saves to the temporary folder and
from there i move it to where i need to be (this happens when i accept the
photo after i see the snapshot and i am redirected back to my application, so
the accept feature triggers it to be saved in 2 places). the photo which is
saved to DCIM/Camera i don't see it when i open the gallery, but i see it when
i navigate the card folders, so saveToPhotoAlbum does not help here. is there a
setting not to save it at all, only on the temporary folder?
System: Motorola x play, android 7.1.1, cordova-plugin-camera 4.0.3
[ Full content available at:
https://github.com/apache/cordova-plugin-camera/issues/337 ]
This message was relayed via gitbox.apache.org for [email protected]