Meteor cordova image share


#1

I am building a METEOR app where users can click/upload images using camera and gallery. And other users should be able to see the image and download it. (same as whatsapp)

I have installed the following plugins :

cordova-plugin-camera@2.4.1,

cordova-plugin-file@4.3.3

Here’s my code :

var cameraOptions = {
    quality: 100,
    previewDrag: false,
    sourceType: sourcetype,
    correctOrientation: true,
    allowEdit: true,
    saveToPhotoAlbum : true,
    mediaType : Camera.MediaType.PICTURE,
    destinationType : Camera.DestinationType.FILE_URI,
    encodingType: Camera.EncodingType.JPEG,
    popoverOptions: CameraPopoverOptions
};
navigator.camera.getPicture(function cameraSuccess(fileURI){
    resolveLocalFileSystemURL(dataURL, function(entry) {
		Session.set('imgData', entry.toInternalURL());			
	});
}, function cameraError(error){
    Session.set('imgData', false);
}, cameraOptions);`

Session.get(‘imgData’) is passed as img src (image not rendering though)

I am getting the following error :

         "Not allowed to load local resource'"

I have inserted the following in my template head

        <meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline'; img-src * 'unsafe- 
               inline';">

Still the error persists.

Server-side code

        Media = new FS.Collection("media", {
stores: [new FS.Store.GridFS("media", {path: "~/uploads"})]
      });

     Media.allow({
insert: function (userid, doc) {
  // add custom authentication code here
	return true;
},
download: function(userid, doc){
	return true;
}
     });

Not sure how to proceed though. Any insights??

PS: future tasks include iploading video, pdf, docs and other files too. So an answer that also helps with that would be highly appreciated.


#2

Where do you stuck exactly?


#3

getting the error

“Not allowed to load local resource:’”


#4

It seems that the required permissions to access photo library/camera or the file system are not addressed. Maybe this plug-in gives some insights for your implementation.