Social Share Plugin Cordova/Phonegap -
i using social share plugin cordova (https://github.com/bfcam/phonegap-ios-social-plugin), , have working. wondering if there way have image have taken or library shared instead of predefined image. have functions set take picture , select image library. thanks.
i using imagefilter plugin here code index.html page
<!doctype html> <html> <head> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> <meta charset="utf-8"> <link rel="stylesheet" href="css/style.css"> <!-- core --> <script src='js/core/cordova-1.6.0.js'></script> <script src='js/core/jquery.js'></script> <!-- plugins --> <script src='js/plugins/imagefilter.js'></script> <script src='js/core/social.js'></script> <!-- our scripts --> <script src='js/init.js'></script> <script> window.plugins.social.available(function(avail) { if (avail) { // show social widgets } else { // social not supported } }); </script> </head> <body onload="app.bodyload()"> <div id="header"><img src="images/header.png" width="100%"></div> <div id="wrapper"> <div id="content"> <!-- buttons --> <div id="buttons"> <div class="btn" id="camera" onclick="app.usecamera();">use camera</div> <div class="btn" id="roll" onclick="app.useroll();">use library</div> <div class="btn" id="share" onclick="window.plugins.social.share('', '', 'www/images/filters/stark.png');">share</div> </div> <!-- end buttons --> <!-- image area --> <div id="imagearea"> <!-- our image --> <div class="photo"></div> <!-- filters --> <div id="filters"> <div class="filter" id="none" onclick="filters.none(largeimage);"> <div class="filtericon"><img src="images/filters/none.png" height="100%"></div> <div class="filtertitle">none</div> </div> <div class="filter" id="sunnyside" onclick="filters.sunnyside(largeimage);"> <div class="filtericon"><img src="images/filters/sunnyside.png" height="100%"></div> <div class="filtertitle">sunnyside</div> </div> <div class="filter" id="worn" onclick="filters.worn(largeimage);"> <div class="filtericon"><img src="images/filters/worn.png" height="100%"></div> <div class="filtertitle">worn</div> </div> <div class="filter" id="vintage" onclick="filters.vintage(largeimage);"> <div class="filtericon"><img src="images/filters/vintage.png" height="100%"></div> <div class="filtertitle">vintage</div> </div> <div class="filter" id="stark" onclick="filters.stark(largeimage);"> <div class="filtericon"><img src="images/filters/stark.png" height="100%"></div> <div class="filtertitle">stark</div> </div> </div> </div> <!-- end image area --> </div> </div> </body> </html>
here js image filter plugin allows me select image library or tak picture camera
var largeimage; var app = { bodyload: function () { document.addeventlistener("deviceready", app.deviceready, false); }, deviceready: function () { app.init(); }, init: function () { }, usecamera: function () { navigator.camera.getpicture(app.oncamerasuccess, app.oncamerafail, { quality: 100, destinationtype: camera.destinationtype.file_uri, sourcetype: camera.picturesourcetype.camera, //allowedit : true, encodingtype: camera.encodingtype.jpeg, targetwidth: 910, targetheight: 910, savetophotoalbum: false }); }, useroll: function () { navigator.camera.getpicture(app.oncamerasuccess, app.oncamerafail, { quality: 100, destinationtype: camera.destinationtype.file_uri, sourcetype: camera.picturesourcetype.photolibrary, encodingtype: camera.encodingtype.jpeg, targetwidth: 910, targetheight: 910, savetophotoalbum: false }); }, oncamerasuccess: function (imageuri) { largeimage = imageuri; $(".photo").html("<img src='" + imageuri + "'>"); $(".photo").show(); }, oncamerafail: function (msg) { console.log("error! -" + msg); } }; var filters = { none: function (imageuri) { plugins.imagefilter.none(filters.rendered, { image: imageuri, save: 'false', }); }, sunnyside: function (imageuri) { plugins.imagefilter.sunnyside(filters.rendered, { image: imageuri, save: 'false' }); }, worn: function (imageuri) { plugins.imagefilter.worn(filters.rendered, { image: imageuri, save: 'false' }); }, vintage: function (imageuri) { plugins.imagefilter.vintage(filters.rendered, { image: imageuri, save: 'false' }); }, stark: function (imageuri) { plugins.imagefilter.stark(filters.rendered, { image: imageuri, save: 'false' }); }, rendered: function (msg) { $(".photo").html("<img src='" + msg + "'>"); } }
i struggling parameter use replace 'www/image/local_image.jpg' in order share image have taken or selected library.
the readme file plugin says can share things this:
window.plugins.social.share('this message want share', 'http://someurl.com', 'www/image/local_image.jpg');
you should therefore able share image have, replace 'www/image/local_image.jpg' path image want share. if have code take picture or select image library, should trivial.
Comments
Post a Comment