1

I am trying to share image from gallery and want to get it in my ionic application. I have tried a lot but still not understanding this.

I have tried following plugins:

https://github.com/protonet/cordova-plugin-share-extension-helper

https://github.com/markmarijnissen/cordova-plugin-share

How to share content/data through other apps in an iOS app like we do in an Android app with Intent.ACTION_SEND?

http://www.technetexperts.com/mobile/share-extension-in-ios-application-overview-with-example/

https://github.com/LokeshPatel/iOS-Phonegap-app-share-extension

halfer
  • 19,824
  • 17
  • 99
  • 186
Bhavan Patel
  • 1,755
  • 1
  • 16
  • 30
  • try this: https://stackoverflow.com/questions/30559991/cordova-register-file-types-to-open-with-list?noredirect=1&lq=1 – Vishal Sharma Jul 01 '17 at 13:34
  • @BhavanPatel unfortunately what you are looking forward is not straight forward in iOS. Check out my answer here - https://stackoverflow.com/questions/43712312/make-ionic-app-appear-in-share-list-and-receive-data/43867316#43867316 Hope it helps. Let me know your comments so that i can add the answer here too. – Gandhi Jul 02 '17 at 17:57
  • @BhavanPatel Any update on this? – Gandhi Jul 04 '17 at 03:23
  • @Gandhi Not yet trying to achieve it. – Bhavan Patel Jul 04 '17 at 05:19
  • @BhavanPatel Could you accept the answer so that it will be helpful for others too and bounty seems to be running out – Gandhi Jul 05 '17 at 07:28

2 Answers2

1

After some detailed analysis, this is what I could conclude:

In Android, you could just get your application added in the share list using cordova-plugin-intent as described in this SO Post. You can also achieve this by adding intent filter in the activity as described here

In iOS, this is bit tricky as there are no straight forward plugins or readymade solution available to achieve this. But the best possible link i could get related to adding app in iOS share menu is getting listed in share menu The link includes apple documentation to do this and also some tweaking in Info.plist to achieve this.

halfer
  • 19,824
  • 17
  • 99
  • 186
Gandhi
  • 11,875
  • 4
  • 39
  • 63
-1

You can use this plugin https://github.com/wymsee/cordova-imagePicker The usage has been described there. It gives you the path of the image.

You can use that path or read the imagefile to get base64 equivalent of it. e.g.

window.imagePicker.getPictures(
function(results) {
    for (var i = 0; i < results.length; i++) {
        createImage(results[i])
    }
}, function (error) {
    console.log('Error: ' + error);
})

createImage(fileURL){
  var img = new Image();
  img.crossOrigin = 'Anonymous';
  img.src = fileURL;      
  img.onload = function(){
      // processing
}}
Gaurav Chaudhary
  • 1,491
  • 13
  • 28
  • I don't want image picker. I want like my app shows in gallery [in share extension] and on click of that share extension , I want to get that image in my application. – Bhavan Patel Jun 26 '17 at 06:35
  • @BhavanPatel This also opens the gallery and allow you to choose images. I have used this plugin and displayed the images in my ionic application. Is your use case different? – Gaurav Chaudhary Jun 26 '17 at 06:44
  • My case is different If I want image from gallery I have already used picker one but I want to share image to my application. As whatsapp has dual functionality like also attach from app and also share from gallery to application... I have already implemented pick from application but I also need to share image from gallery to my application. – Bhavan Patel Jun 26 '17 at 06:53
  • @BhavanPatel hope this can help https://blog.bam.tech/developper-news/building-a-picture-gallery-with-cordova – Gaurav Chaudhary Jun 26 '17 at 07:03