angularjs - Camera plugin + cordova social sharing -
i'm using camera plugin take photo, , want share photo cordova social sharing plugin, don't know how...
the camera works fine, , shows me photo i'd taken
ionicapp.controller("functions", function($scope, $rootscope, $cordovacamera) { $rootscope.takepicture = function() { var options = { quality : 75, destinationtype : camera.destinationtype.data_url, sourcetype : camera.picturesourcetype.camera, allowedit : true, encodingtype: camera.encodingtype.jpeg, targetwidth: 300, targetheight: 300, popoveroptions: camerapopoveroptions, savetophotoalbum: false }; $cordovacamera.getpicture(options).then(function(imagedata) { var image = document.getelementbyid('myimage'); $rootscope.imguri = "data:image/jpeg;base64," + imagedata; }, function(err) { // error occured. show message user }); }
});
ionicapp.controller("share", function($scope, $cordovasocialsharing) {
$scope.shareanywhere = function() { $cordovasocialsharing.share("#dstry_cam", "#dstry_cam", "www/imagefile.png", "http://dstrycam.com"); }
});
but how can put photo taken before in share function? believe changing "www/imagefile.png" don't know how.
thank you, , sorry bad english
please refer github link.
https://github.com/eddyverbruggen/socialsharing-phonegap-plugin
this cordova plugin reflection of $cordovasocialsharing using ngcordova. got base64 image url using $cordovacamera. can share image using share() function of $cordovasocialsharing.
for example,
$cordovasocialsharing .share(null,"filename.jpg", $rootscope.imguri, null) .then(function(result) { // success callback }, function(err) { // error callback });
this let to share picture (under filename of "filename.jpg") opening built-in share dialog in both ios , android. pretty simple.
edit: need include $rootscope in controller.
Comments
Post a Comment