Comments (4)
The general approach for sharing the image when having the file path is to get the file content using the FileSystem API. The key API for getting the content in a form that is compatible with the plugin is FileReader.readAsDataURL.
from instagramplugin.
Can you explain how to do it?
from instagramplugin.
There is a good article on HTML5Rocks on how to use the Filesystem API. Have a look at the Reading a file by name section.
from instagramplugin.
Here's how to do it:
Add org.apache.cordova.file and use this code:
navigator.screenshot.save(function(error,res){
if(error){
console.error(error);
}else{
window.resolveLocalFileSystemURL("file://"+res.filePath, gotFile, fail);
});
function fail(e) {
console.log("FileSystem Error");
console.dir(e);
}
function gotFile(fileEntry) {
fileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function(e) {
Instagram.share(this.result, function (err) {
if (err) {
console.log("not shared insta");
} else {
console.log("shared insta");
}
});
}
reader.readAsDataURL(file);
});
}
from instagramplugin.
Related Issues (20)
- Share to story gives black image HOT 1
- Android App crash when launch HOT 3
- kept on getting Instagram is undefined error
- Upgrade to using cordova-clipboard plugin rather than the universal-clipboard-plugin HOT 4
- Story gives black image HOT 13
- Share video from Android HOT 3
- IOS 13: Can not select Instagram app HOT 12
- Unable to load image for FEED HOT 15
- iOS 13.6.1 Instagram share option does not work HOT 8
- [Suggestion] - Option to set share type HOT 3
- Error when sharing image to Instagram (iOS) HOT 15
- Android API 30 - Instagram not installed HOT 4
- IOS only - Error when sharing image/asset/product to the instagram story/message/post works fine for reels
- Instagram: Not able to share Multiple images HOT 1
- Plugin doesn't work on iPhone X HOT 1
- Not able to post to feed via ios(asking to select between feed & story) HOT 2
- Instagram composer not returning to app after img is shared HOT 3
- Ionic plugin wrapper causes plugin install error HOT 2
- Plugin should not reinstall cordova-plugin-clipboard if it already exists
- Plugin not working on Android 8.0 HOT 49
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instagramplugin.