Code Monkey home page Code Monkey logo

imagepicker's Introduction

cordova-imagePicker

Cordova Plugin For Multiple Image Selection - implemented for iOS and Android 4.0 and above.

Installing the plugin

The plugin conforms to the Cordova plugin specification, it can be installed using the Cordova / Phonegap command line interface.

# without desc
phonegap plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git
cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git

# with desc
phonegap plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"

cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"

Using the plugin

The plugin creates the object window.imagePicker with the method getPictures(success, fail, options)

Example - Get Full Size Images (all default options):

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

Example - Get at most 10 images scaled to width of 800:

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

Options

options = {
    // Android only. Max images to be selected, defaults to 15. If this is set to 1, upon
    // selection of a single image, the plugin will return it.
    maximumImagesCount: int,
    
    // max width and height to allow the images to be.  Will keep aspect
    // ratio no matter what.  So if both are 800, the returned image
    // will be at most 800 pixels wide and 800 pixels tall.  If the width is
    // 800 and height 0 the image will be 800 pixels wide if the source
    // is at least that wide.
    width: int,
    height: int,
    
    // quality of resized image, defaults to 100
    quality: int (0-100),

    // output type, defaults to FILE_URIs.
    // available options are 
    // window.imagePicker.OutputType.FILE_URI (0) or 
    // window.imagePicker.OutputType.BASE64_STRING (1)
    outputType: int
};

Note for Android Use

When outputType is FILE_URI the plugin returns images that are stored in a temporary directory. These images will often not be deleted automatically though. The files should be moved or deleted after you get their filepaths in javascript. If Base64 Strings are being returned, there is nothing to clean up.

Android 6 (M) Permissions

On Android 6 you need to request permission to read external storage at runtime when targeting API level 23+. Even if the uses-permission tags for the Calendar are present in AndroidManifest.xml.

Note that the hasReadPermission function will return true when:

  • You're running this on iOS, or
  • You're targeting an API level lower than 23, or
  • You're using Android < 6, or
  • You've already granted permission.
  function hasReadPermission() {
    window.imagePicker.hasReadPermission(
      function(result) {
        // if this is 'false' you probably want to call 'requestReadPermission' now
        alert(result);
      }
    )
  }

  function requestReadPermission() {
    // no callbacks required as this opens a popup which returns async
    window.imagePicker.requestReadPermission();
  }

Note that backward compatibility was added by checking for read permission automatically when getPictures is called. If permission is needed the plugin will now show the permission request popup. The user will then need to allow access and invoke the same method again after doing so.

Libraries used

ELCImagePicker

For iOS this plugin uses the ELCImagePickerController, with slight modifications for the iOS image picker. ELCImagePicker uses the MIT License which can be found in the file LICENSE.

https://github.com/B-Sides/ELCImagePickerController

MultiImageChooser

For Android this plugin uses MultiImageChooser, with modifications. MultiImageChooser uses the BSD 2-Clause License which can be found in the file BSD_LICENSE. Some code inside MultImageChooser is licensed under the Apache license which can be found in the file APACHE_LICENSE.

https://github.com/derosa/MultiImageChooser

FakeR

Code(FakeR) was also taken from the phonegap BarCodeScanner plugin. This code uses the MIT license.

https://github.com/wildabeast/BarcodeScanner

License

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

imagepicker's People

Contributors

allie-wake-up avatar andyssssss avatar anuj-logiciel avatar anujraghuvanshi avatar arcademode avatar csullivan102 avatar dmcnamara avatar eddyverbruggen avatar eliadafeka avatar erikramalho avatar hanssens avatar hayashizaki-masayuki avatar hkjeffchan avatar jarosy avatar mbuchalik avatar mickaelmagniez avatar pcsantana avatar qstarx avatar quangpdt avatar rabeyta avatar robpaveza avatar ronnnn avatar sereysethy avatar shanebdavis avatar simba909 avatar sjerd avatar takeo-asai avatar uaza avatar virkinia avatar xueron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagepicker's Issues

Android App crash when outputType is Base64

Great pluggin,
When outputType is 1 ( Base64)
1-When the phone is vertical , yo can select the image but th OK/cancel button didn't return.
2-When is horizontal the app chash.

When outputType id 0 everithing is ok.

Thanks Fernando.

Issue while selecting 10 or more images

When I select more than 10 images with following options, the gallery does not respond and I get stuck on the gallery page only. The Gallery stops working.

var options = {
maximumImagesCount: 10,
width: 450,
quality: 60,
outputType: window.imagePicker.OutputType.BASE64_STRING
};

width parameter is ignored

Hi,

When setting options to
{ width: 800, quality: 80 }

Quality parameter is ok, but width parameter is ignored.

iOS Image Format

I have a sample app successfully running on both Android as well as iOS .. once the images are selected i use FileTransfer to upload them to my web server .. both os's do upload files; but I can not open the JPG images from the iOS device with any application other than Photoshop CS6.

I suspect the file is not a true JPG or contains some bits and pieces that make most apps including PREVIEW on OSX report the file is corrupt. Any assistance or guidance would be much appreciated.

I have attached two sample files.
cdv_photo_003
cdv_photo_004

Failed to fetch plugin using Cordova 7

This plugin have been working fine until ionic 3.2.0 and Cordova 7.

The cordova-plugin-imagePicker installs fine but when I open the image picker in emulator I get
"console.warn: Install the ImagePicker plugin: 'ionic plugin add
https://github.com/Telerik-Verified-Plugins/ImagePicker'"

console.log: plugin_not_installed

Then when I try to install it:
ionic cordova plugin add
? What plugin would you like to add: ht
tps://github.com/Telerik-Verified-Plugi
ns/ImagePicker

cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker --save
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker --sav... (exit code 1):

How should I install "https://github.com/Telerik-Verified-Plugins/ImagePicker"?

Not listing iCloud synched photos on ios10.2 - iPhone 6 Plus

Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: OS X El Capitan
Node Version: v6.9.2
Xcode version: Xcode 8.2.1 Build version 8C1002

cordova plugin list
com.synconset.imagepicker 2.1.7 "ImagePicker"
cordova-plugin-camera 2.3.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.4 "Console"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-file 4.3.1 "File"
cordova-plugin-image-picker 1.1.1 "ImagePicker"
cordova-plugin-splashscreen 4.0.0 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.3.0 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

Image picker not listing photos those are synched with iCloud, also sometime it show more pictures but not all .Cordova Camera plugin lists all photos with icloud same settings . Please help

Attached icloud settings screen print and Image Picker list view screen print

img_2666
img_2665

"com.synconset.imagepicker" incorrectly adding to package.json dependencies

When using this plugin with Ionic (as per http://ionicframework.com/docs/native/image-picker/) it's breaking.

After running ionic cordova plugin add cordova-plugin-telerik-imagepicker and npm install --save @ionic-native/image-picker everything seems fine.

But when you then go to use ionic cordova run or ionic cordova build a reference to "com.synconset.imagepicker" is inserted into the package.json dependencies list. This is not a valid node module name, so it fails the next time npm install is run.

IOS – Selecting a picture has a delay

IOS (9.x/ 10.x): Currently when you select a picture, it needs some seconds to be actually marked as selected (depends on the file size).
While the imagePicker needs time to select the picture and the user presses on the picture again, then the imagePicker selects the picture 2 times. When you deselect the picture one copy of the picture still exists and still selected, but not visible selected in the GUI.

Android base64 fails

base64 outputType fails for bigger images on android.
Here are the logs:

> 03-16 16:08:53.945 1829-6420/com.veryc. D/dalvikvm: GC_FOR_ALLOC freed 345K, 7% free 55239K/59028K, paused 17ms, total 17ms
> 03-16 16:08:54.235 1829-5611/com.veryc D/dalvikvm: GC_FOR_ALLOC freed 804K, 8% free 58658K/63252K, paused 18ms, total 18ms
> 03-16 16:08:54.265 1829-5611/com.veryc D/dalvikvm: GC_FOR_ALLOC freed 3237K, 12% free 57963K/65764K, paused 17ms, total 17ms
> 03-16 16:08:54.315 1829-5611/com.veryc I/dalvikvm-heap: Grow heap (frag case) to 91.801MB for 31961104-byte allocation
> 03-16 16:08:54.715 1829-6423/com.veryc D/dalvikvm: GC_FOR_ALLOC freed 24478K, 31% free 67747K/96980K, paused 17ms, total 17ms
> 03-16 16:08:54.955 1829-5611/com.veryc D/dalvikvm: GC_FOR_ALLOC freed 1091K, 26% free 72624K/96980K, paused 15ms, total 15ms
> 03-16 16:08:54.995 1829-1829/com.veryc E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!
> 03-16 16:08:55.015 1829-1829/com.veryc E/ViewRootImpl: sendUserActionEvent() mView == null
> 03-16 16:10:26.695 1829-1829/com.veryc D/Activity: #1 setTransGradationModeColor false

Support for iCloud photos on iOS

Sorry to be a bother, but there seem to be some issues when using iCloud photo library with this plugin. Selecting images that have been downloaded to the device works fine, but image assets that haven't been downloaded to the device return null, as per Apples documentation: https://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAsset_Class/#//apple_ref/occ/instm/ALAsset/defaultRepresentation

To provide better compatibility with iOS 8 and forward I'd suggest using the Photos Framework instead, unfortunately I don't have the time right now to do it myself and supply a PR... 😞

Failed to install this plugin on ionic project

After the last Ionic and Cordova updates, according to the official ionic documentation, you can install this plugin by typing: " ionic cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker ". But, an error occurred while running this command, even after you added the package.json file.

Results:

 cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker --save
✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker --sav... (exit code 1):

        Error: Failed to fetch plugin https://github.com/Telerik-Verified-Plugins/ImagePicker via registry.
        Probably this is either a connection problem, or plugin spec is incorrect.
        Check your connection and plugin name/version/URL.
        Error: cmd: Command failed with exit code 1 Error output:
        npm ERR! exited with error code: 128

        npm ERR! A complete log of this run can be found in:
        npm ERR!     C:\Users\mrfirases\AppData\Roaming\npm-cache\_logs\2017-06-06T07_22_17_209Z-debug.log

This is the content of the 2017-06-06T07_22_17_209Z-debug.log file:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\mrfirases\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'https://github.com/Telerik-Verified-Plugins/ImagePicker',
1 verbose cli   '--save' ]
2 info using [email protected]
3 info using [email protected]
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 silly fetchPackageMetaData error for git+https://github.com/Telerik-Verified-Plugins/ImagePicker.git exited with error code: 128
7 verbose stack Error: exited with error code: 128
7 verbose stack     at ChildProcess.onexit (C:\Users\mrfirases\AppData\Roaming\npm\node_modules\npm\node_modules\mississippi\node_modules\end-of-stream\index.js:39:36)
7 verbose stack     at emitTwo (events.js:106:13)
7 verbose stack     at ChildProcess.emit (events.js:191:7)
7 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
8 verbose cwd C:\Users\mrfirases\Desktop\asb\node_modules
9 verbose Windows_NT 10.0.15063
10 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mrfirases\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "https://github.com/Telerik-Verified-Plugins/ImagePicker" "--save"
11 verbose node v6.9.4
12 verbose npm  v5.0.0
13 error exited with error code: 128
14 verbose exit [ 1, true ]

iOS localization

I am compiling using PhoneGap build with cli-6.0.0. The picker seems to work fine but for some reason, the controls aren't localized correctly. My iPad Air 2 is set to German and all other native controls in my application are German as well (e.g. when clicking on a file input). The picker, however, always shows the English controls.

I have seen that there are localization files at ImagePicker/src/ios/GMImagePicker/de.lproj/GMImagePicker.strings
Is it possible that these files don't get added correctly to the build path? What else can I do to apply the correct .strings file to my application?

Failed to plugin this ImagePicker

I'm try to use this plugin, but after I follow instruction install the plugin, this error come out:

Error: Failed to fetch plugin https://github.com/Telerik-Verified-Plugins/ImagePicker.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 235 Error output:
npm ERR! addLocal Could not install /tmp/npm-43275-57a90394/git-cache-aa97fcb4/1d453300ae3dacb007a404fd59536afcb67ab286
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/Cellar/node/7.9.0/bin/node" "/usr/local/bin/npm" "install" "https://github.com/Telerik-Verified-Plugins/ImagePicker.git" "--save"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/haoxiangli/develop/pmtoolbelt/pmtoolbelt_maintain_mobile/node_modules/npm-debug.log

Did I miss something? what should I do to set up this thing?

Use via Ionic-Native ignores maximumImagesCount

I'm using the plugin in my ionic2 app. When I use the plugin via ionic-native it ignores the maximumImagesCount option and allows the user to select any number of pictures.
Here's my code:
addCameraImage(image:any){ let opts = { outputType: 1, maximumImagesCount: 1, quality: 65 } this.imagePicker.getPictures(opts).then((results) => { this.spinner.show("Uploading","Please wait while your image is uploaded...",true) for (var i = 0; i < results.length; i++) { this.changed = true; let base64Image = 'data:image/jpeg;base64,' + results[i]; firebase.storage().ref().child(/images/${this.authProvider.getUID()}/${this.randomString()}.jpeg).putString(results[i],'base64',{contentType:'image/jpeg'}).then(snapshot=>{ this.spinner.hide() if (!image){ this.images.push(snapshot.downloadURL) }else { let idx = this.images.indexOf(image); this.images[idx] = snapshot.downloadURL; } }); } }, (err) => { }); }

Is there a way to get the original image (native uri)

Hi, thanks for this great plugin!

I'd like to get original images (Native Uri) to have EXIF data because the current way File Uri removes EXIF information.
I've been researching for this but hard to find how to do it.
If anyone knows this, please help me out.

Thanks !

image not shown in android when using URI

helo

when we use URI for showing image in android. it does not show..
the uri something like this: file///data/data/.../xxx.jpg

but when we use base64. it shown perfectly.

why?

how do we get the absolute path?

Path to original files not thumbnails

Hi @EddyVerbruggen,

first of all, great repo!
First, Is there any way you could provide the paths to the original selected files and not only the path to the temporary thumbnails?
I need the EXIF data of the original files.

Second (in combination with First), if I select a video i get a path to a created thumbnail image.
Is it possible for you to give us the path to the original video?

Thanks in advance,
pixxio

Get pictures in multiple qualities?

Currently, you can set the quality parameter in the options object when using window.imagePicker.getPictures. What I need is both low and high quality versions of the picked images. High quality images to upload to the server and low quality images to use as thumbnails.
What is the best way of doing this?

Error: Failed to fetch plugin

I run this command in ionic cli
sudo ionic cordova plugin add cordova-plugin-telerik-imagepicker
and get this output

> cordova plugin add cordova-plugin-telerik-imagepicker --save
✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.
        
[ERROR] An error occurred while running cordova plugin add
        cordova-plugin-telerik-imagepicker --save (exit code 1):
        
        Error: Failed to fetch plugin
        git+https://github.com/Telerik-Verified-Plugins/ImagePicker.git via
        registry.
        Probably this is either a connection problem, or plugin spec is
        incorrect.
        Check your connection and plugin name/version/URL.
        Failed to get absolute path to installed module

my config is :

ionic -v3.5.0
cordova -v7.0.1
npm -v4.2.0
node -v7.10.1
android -v 6.2.1

please help me @EddyVerbruggen

Android crash: CallbackContext is null

This is a more common problem. Please also see here for easy reproducting and where you already fixed this issue:
Telerik-Verified-Plugins/BarcodeScanner#26

Crash log:

java.lang.RuntimeException: Unable to resume activity {com.myapp.android/com.myapp.android.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {com.myapp.android/com.myapp.android.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(org.json.JSONArray)' on a null object reference
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3527)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3558)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2878)
    at android.app.ActivityThread.access$900(ActivityThread.java:181)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6145)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {com.myapp.android/com.myapp.android.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(org.json.JSONArray)' on a null object reference
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4196)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3513)
    ... 11 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(org.json.JSONArray)' on a null object reference
    at com.synconset.ImagePicker.onActivityResult(ImagePicker.java:135)
    at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:151)
    at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:348)
    at android.app.Activity.dispatchActivityResult(Activity.java:6632)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4192)
    ... 12 more

Will hopefully have some time next month to help with some bug fixing!

IOS plugin crashes when permission denied

The plugin crashes when cancel button is pressed and permission to access photos is denied.

2017-05-03 12:17:08.453006 CheckAndPack[2034:629433] GMImagePicker: User pressed cancel button
2017-05-03 12:17:09.145978 CheckAndPack[2034:629433] [Generic] *** This application is not allowed to access Photo data. (
0 PhotoLibraryServices 0x2813fde1 + 1440
1 Photos 0x28c4154b + 62
2 libdispatch.dylib 0x003f3d43 _dispatch_client_callout + 22
3 libdispatch.dylib 0x003f4951 dispatch_once_f + 86
4 Photos 0x28c41509 + 132
5 Photos 0x28c17be7 + 134
6 Photos 0x28c2e44f + 182
7 libobjc.A.dylib 0x1da5d195 + 238
8 CheckAndPack 0x0014683d -[GMAlbumsViewController .cxx_destruct] + 40
9 libobjc.A.dylib 0x1da42047 + 116
10 libobjc.A.dylib 0x1da4cec5 objc_destructInstance + 34
11 libobjc.A.dylib 0x1da4cee5 object_dispose + 14
12 UIKit 0x23c18e93 + 138
13 UIKit 0x23a0f619 + 1772
14 UIKit 0x23a7c563 + 220
15 CheckAndPack 0x00143c83 -[GMAlbumsViewController dealloc] + 160
16 CoreFoundation 0x1e7d24df + 182
17 CoreFoundation 0x1e6f1a47 + 14
18 libobjc.A.dylib 0x1da5d195 + 238
19 UIKit 0x23a0f5ef + 1730
20 UIKit 0x23a1a081 + 464
21 CheckAndPack 0x00152431 -[GMImagePickerController .cxx_destruct] + 40
22 libobjc.A.dylib 0x1da42047 + 116
23 libobjc.A.dylib 0x1da4cec5 objc_destructInstance + 34
24 libobjc.A.dylib 0x1da4cee5 object_dispose + 14
25 UIKit 0x23c18e93 + 138
26 UIKit 0x23a0f619 + 1772
27 CheckAndPack 0x0015051d -[GMImagePickerController dealloc] + 62
28 libobjc.A.dylib 0x1da5d6eb + 616
29 CoreFoundation 0x1e6e92b9 _CFAutoreleasePoolPop + 16
30 CoreFoundation 0x1e79a795 + 1428
31 CoreFoundation 0x1e6e9533 CFRunLoopRunSpecific + 486
32 CoreFoundation 0x1e6e9341 CFRunLoopRunInMode + 104
33 GraphicsServices 0x1fec0bfd GSEventRunModal + 156
34 UIKit 0x238f7e67 + 574
35 UIKit 0x238f2591 UIApplicationMain + 150
36 CheckAndPack 0x000dbcc3 main + 50
37 libdyld.dylib 0x1deb350b + 2
)
2017-05-03 12:17:09.147056 CheckAndPack[2034:629433] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'This application is not allowed to access Photo data.'
*** First throw call stack:
(0x1e7e0df7 0x1da43077 0x2813fe69 0x28c4154b 0x3f3d43 0x3f4951 0x28c41509 0x28c17be7 0x28c2e44f 0x1da5d195 0x14683d 0x1da42047 0x1da4cec5 0x1da4cee5 0x23c18e93 0x23a0f619 0x23a7c563 0x143c83 0x1e7d24df 0x1e6f1a47 0x1da5d195 0x23a0f5ef 0x23a1a081 0x152431 0x1da42047 0x1da4cec5 0x1da4cee5 0x23c18e93 0x23a0f619 0x15051d 0x1da5d6eb 0x1e6e92b9 0x1e79a795 0x1e6e9533 0x1e6e9341 0x1fec0bfd 0x238f7e67 0x238f2591 0xdbcc3 0x1deb350b)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

Property 'hasReadPermission' does not exist on type 'typeof ImagePicker

I am getting this error: Property 'hasReadPermission' does not exist on type 'typeof ImagePicker

Here is how i am using it
import:
import { ImagePicker } from 'ionic-native';

passed as provider in component decorator
@Component({ selector: 'page-landing', templateUrl: 'landing.html', providers: [HomePageProducts,General,Auth,ImagePicker], })

In the function:
test(){ ImagePicker.hasReadPermission().then((data) => { console.log(data); }).catch((err) => { console.log(err); }) }

iOS ImagePicker and application crashes after browsing many images.

On iPad, iOS 9, plugin v. 2.1.1 : the collection view (image picker) crashes after browsing gallery with many images. It looks like the UIView in Cell used to display the Image does not deallocate it after it was displayed in collection . Cells UIView is "strong" in this code and it fills up the memory and crashes the app.

Select multiple images from Android Photo Library / Gallery

In Android, by setting the sourceType to photolibrary the plugin neatly allows selecting a picture from a Gallery:

navigator.camera.getPicture(onCameraSuccess, onCameraFail, {
    ...
    sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
    ...
});

However, with this you can only select a single picture. Is there a way to extend this to allow the selection of multiple images from a gallery, like iOS does?

Android crash: not attached to window manager

java.lang.IllegalArgumentException: View=com.android.internal.policy.PhoneWindow$DecorView{cf8c1a1 V.E...... R.....ID 0,0-1026,483} not attached to window manager
    at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:424)
    at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:350)
    at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:116)
    at android.app.Dialog.dismissDialog(Dialog.java:362)
    at android.app.Dialog.dismiss(Dialog.java:345)
    at com.synconset.MultiImageChooserActivity$ResizeImagesTask.onPostExecute(MultiImageChooserActivity.java:618)
    at com.synconset.MultiImageChooserActivity$ResizeImagesTask.onPostExecute(MultiImageChooserActivity.java:508)
    at android.os.AsyncTask.finish(AsyncTask.java:651)
    at android.os.AsyncTask.access$500(AsyncTask.java:180)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:168)
    at android.app.ActivityThread.main(ActivityThread.java:5845)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)

Phone details:

HTC One (M8) (htc_m8) 1
Manufacturer        HTC
Android version        Android 4.0.3 - 4.0.4
RAM (MB)        2048
Screen size        1080 × 1920
Screen density (dpi)        480
OpenGL ES version        3.0
Native platform        armeabi-v7a
CPU make        Qualcomm
CPU model        MSM8974AB 

Possibly related to orientation change or otherwise closing/restarting of the main activity while the imagepicker is open. Solution might be using WeakReferences to the original activity and checking them for null and handling properly when the main activity has stopped.

IOS: UI

do you plan to update the UI for ios to match the cordova-plugin-imagepicker, or at least a cleaner look for users?

Doesn't return to base app

I am using this in place of camera.getPicture because I want to allow users to upload multiple photos, but while testing I can't get back to the base app. I click on the "load from library" button in my app, which opens up the imagePicker, I select 2 images, click on "OK" at the top, a popup shows up that says "Processing images, this may take a while" then after a short period that goes away and I am still at the image picker screen, it never goes back to my app. I can click more images, select ok and the same thing happens. popup, then it goes away, and I sit at the image picker screen. I can't hit cancel at all. I am just stuck at the image picker screen. My code is pretty simple for this,

let actionSheet = this.actionSheetCtrl.create({
  title: "Select Image Source",
  buttons: [
    {
      text: 'Load from Library",
      handler: () => {
        this.imagePicker.getPictures({quality: 100, maximumImagesCount: 5, outputType: 1}).then((results => {
          console.log("images");
          console.log(results);
      });
    }
  ]
});
actionSheet.present();

I have tried changing outputType = 0 and it does the same thing, it never returns me to my app, and it won't let me hit cancel. Nothing shows up in the console either.

Any alternative for max images restriction?

How to restrict the user to select maximum 5 images?

I just followed this link: guillermomuntaner/GMImagePicker#24. But shouldSelectAsset function is not triggering before highlighting the image.

I am just showing the alert saying that "You can select max 5 images" when it is selectedImagesCount > 5. But user still able to select 5 images.

How can we solve this?

show gallery folder structure

every time I want to choose a picture or mutiple pictures using imagePicker plugin, it shows all the images avialable on the device at once. is there a way to make it show them by groups. I mean, first when you want to choose a picture or multiple pictures it shows the folders where the pictures are stored, (downloads, gallerry, whatsapp ...) then after choosing one of those sources the plugin shows the avialable pictures in there

Image Picker Performance on iPhone 6 /iOS 10 feels rather sluggish

I just made a comparison between the ELC Image Picker in wymsee's implementation with the new one provided in this fork regarding snappiness on an iPhone6 with iOS 10.

While the GMImagePicker is more feature rich, it seems sluggy and sometimes does not seem to respond when selecting images.

Do you have an idea how I could dig deeper into the reasons for this? Maybe its the native implementation part, but I'm not sure. Or is this a known issue?

Android build fails

I am working with the latest ImagePicker plugin. It is not working with Diagnostic plugin. Both plugins work independently. I am unable to build my sdk with ionic run android``. Gradle` throws an error ,

BUILD FAILED

Error: /home/raj/ionic/myapp3/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/home/raj/ionic/myapp3/platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
    
/home/raj/ionic/myapp3/platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
    
/home/raj/ionic/myapp3/platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/home/raj/ionic/myapp3/platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

I did recently updated my SDK tools. I am not sure if thats what cause the problem.

android: 6.2.1
SDK tools: 25
Support Repository: 47
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />

I have build-tools 25,24,23 installed as well.
I did try removing and readding platform and all plugins. Nothing seems to help.

Problem to pick images on Android 7

Platform: Android 7
Devices: Nexus 5x, Samsung Galaxy s8 edge

If you select a couple of images on the Gallery then the picker jump (scroll) somewhere in the middle. Also, if you try to scroll a little bit it will jump (scroll) too much and the there is a delay on loading images.

404 for GET on https://registry.npmjs.org/cordova-plugin-telerik-imagepicker

cordova plugin add cordova-plugin-telerik-imagepicker --variable "PHOTO_LIBRARY_USAGE_DESCRIPTION=your usage message" --save
✖ Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova plugin add cordova-plugin-telerik-imagepicker --variable
"PHOTO_LIBRARY_... (exit code 1):

    Error: Registry returned 404 for GET on https://registry.npmjs.org/cordova-plugin-telerik-imagepicker

Android build fails: incompatibility with phonegap-plugin-push?

$ cordova info
Collecting Data...

Node version: v6.9.4

Cordova version: 6.4.0

Config.xml file:

<?xml version='1.0' encoding='utf-8'?>
...
    <plugin name="cordova-plugin-inappbrowser" spec="~1.5.0" />
    <plugin name="cordova-plugin-facebook4" spec="~1.7.4">
        <variable name="APP_ID" value="..." />
        <variable name="APP_NAME" value="..." />
    </plugin>
    <plugin name="phonegap-plugin-push" spec="~1.9.2">
        <variable name="SENDER_ID" value="..." />
    </plugin>
    <plugin name="cordova-plugin-statusbar" spec="~2.2.1" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
    <plugin name="cordova-plugin-device" spec="1.1.4" />
    <plugin name="cordova-plugin-console" spec="1.0.5" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.1" />
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
    <plugin name="cordova-plugin-geolocation" spec="~2.4.1" />
    <plugin name="cordova-plugin-camera" spec="~2.3.1" />
    <plugin name="cordova-plugin-crop" spec="~0.1.0" />
</widget>

Plugins:

com.synconset.imagepicker,cordova-plugin-camera,cordova-plugin-compat,cordova-plugin-console,cordova-plugin-crop,cordova-plugin-device,cordova-plugin-facebook4,cordova-plugin-geolocation,cordova-plugin-inappbrowser,cordova-plugin-splashscreen,cordova-plugin-statusbar,cordova-plugin-whitelist,ionic-plugin-keyboard,phonegap-plugin-push

Android platform:

Available Android targets:
----------
...
id: 9 or "Google Inc.:Google APIs:23"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 6.0 (API level 23)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_6
$ cordova plugin version | grep 'phonegap-plugin-push\|imagepicker'
com.synconset.imagepicker 2.1.7 "ImagePicker"
phonegap-plugin-push 1.9.2 "PushPlugin"
$ cordova build android --verbose
Error:  <project>/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
<project>/platforms/android/src/com/adobe/phonegap/push/PushHandlerActivity.java:46: error: cannot find symbol
        if(inline && android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N){
                                                                                      ^
  symbol:   variable N
  location: class VERSION_CODES
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    at ChildProcess.whenDone (<project>/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)

After removing the ImagePicker plugin it compiles

Android crash: StaleDataException: Attempted to access a cursor after it has been closed.

android.database.StaleDataException: Attempted to access a cursor after it has been closed.
    at android.database.BulkCursorToCursorAdaptor.throwIfCursorIsClosed(BulkCursorToCursorAdaptor.java:64)
    at android.database.BulkCursorToCursorAdaptor.getCount(BulkCursorToCursorAdaptor.java:70)
    at android.database.CursorWrapper.getCount(CursorWrapper.java:57)
    at com.synconset.MultiImageChooserActivity$ResizeImagesTask.onPostExecute(MultiImageChooserActivity.java:608)
    at com.synconset.MultiImageChooserActivity$ResizeImagesTask.onPostExecute(MultiImageChooserActivity.java:508)
    at android.os.AsyncTask.finish(AsyncTask.java:636)
    at android.os.AsyncTask.access$500(AsyncTask.java:177)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6917)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

Phone details:

Galaxy A5(2016) (a5xelte) 1

Manufacturer Samsung
Android version Android 5.1
RAM (MB) 2048
Screen size 1080 × 1920
Screen density (dpi) 480
OpenGL ES version 3.0
Native platform armeabi-v7a
CPU make Samsung
CPU model Exynos 7580

Possibly incorrect asynchronous handling of image resizing? No idea how this is possible, though checking for a closed cursor first should easily fix the bug. But the source of the problem could be harder to solve and will need some time to research..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.