Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to close the picker view using js code? #204

Open
wants to merge 170 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
665f351
Made appearance closer to the stock Photos app.
Oct 29, 2014
623d445
fixed bug where some images got a white line on the right or bottom. …
shanebdavis Mar 10, 2015
a173570
updated readme with output type example
rabeyta May 18, 2015
ebb74d7
added OutputType to ImagePicker to hold output options
rabeyta May 18, 2015
2bc9516
added validation method for outputType. If there is an invalid value …
rabeyta May 18, 2015
ca844db
updated getPictures to validate the outputType and default it to FILE…
rabeyta May 18, 2015
6c86ffc
added outputType to SOSPicker header
rabeyta May 18, 2015
f15e0b6
created enum to hold outputType values inside SOSPicker
rabeyta May 18, 2015
8bd64c7
set outputType from passed in options
rabeyta May 18, 2015
80b4fc3
based on options for outputType, add base64 encoded string or file_ur…
rabeyta May 18, 2015
5e856c8
created enum to hold OutputType values
rabeyta May 18, 2015
647e284
store outputType in activity based on options passed in
rabeyta May 18, 2015
181e826
added method to getBase64 String from Bitmap
rabeyta May 18, 2015
b772953
added missed import for ByteArrayOutputStream
rabeyta May 18, 2015
0a62ad1
based on outputType option, add base64 string or file uri to output list
rabeyta May 18, 2015
3e5838e
added missing import for base64
rabeyta May 23, 2015
92a1b6b
added missing constant for outputTypeKey
rabeyta May 23, 2015
bfb7025
fixed outputType reference for logic for file or base64 output
rabeyta May 23, 2015
fd055c2
Updated ImagePicker to grab output type from options and pass to plug…
rabeyta May 23, 2015
4452872
Merge branch 'master' of https://github.com/shanebdavis/cordova-image…
EddyVerbruggen Jun 4, 2015
1735907
Merge branch 'improve-appearance' of https://github.com/JonathanAquin…
EddyVerbruggen Jun 4, 2015
959b379
#1 Cordova-Android 4 compatibility
EddyVerbruggen Jun 13, 2015
48711ae
Deleted the ELCImagePicker plugin
hanssens Aug 19, 2015
924651f
Added the GMImagePicker
hanssens Aug 19, 2015
42de0ff
Changed usage of ELC=>GM as dependency
hanssens Aug 19, 2015
2aab5cd
Android plugin now supports thumbnails as well
hanssens Aug 19, 2015
59668e6
Merge pull request #1 from hanssens/replace-elc-with-gm
hanssens Aug 19, 2015
a2ec5ca
Give new options/parameters a default value
hanssens Aug 20, 2015
54444b9
Updated references to GMImagePicker
hanssens Aug 20, 2015
b4cee77
#4 The name of my app on android is now ImagePicker
EddyVerbruggen Oct 28, 2015
ce33f74
Merge remote-tracking branch 'upstream/master'
EddyVerbruggen Oct 28, 2015
b88f710
#2 Support for iCloud photos on iOS
EddyVerbruggen Oct 29, 2015
3900d47
#2 Support for iCloud photos on iOS - modifications
EddyVerbruggen Oct 29, 2015
ecdb593
Implemented support for Cordova 5 Android permissions
simba909 Jan 4, 2016
f524bcc
Removed unused import from ImagePicker
simba909 Jan 7, 2016
1bd72e3
Cleaned up MultiImageChooserActivity
simba909 Jan 7, 2016
6480932
Moved to using AppCompatActivity and the support ActionBar, minor cle…
simba909 Jan 7, 2016
82cc0d6
(Android) Improved actionbar resource files
simba909 Jan 8, 2016
425b111
(Android) More small cleanup, allow cancel even if no image is selected
simba909 Jan 8, 2016
785985c
(Android) Added more translatable strings, added Swedish translation
simba909 Jan 8, 2016
ad94b31
Merge pull request #5 from simba909/master
EddyVerbruggen Jan 20, 2016
8407bca
#5 Implemented support for Cordova 5 Android permissions
EddyVerbruggen Jan 20, 2016
1344f1f
#5 Implemented support for Cordova 5 Android permissions
EddyVerbruggen Jan 21, 2016
350df5f
max images is for Android only since we upgraded the iOS framework to…
EddyVerbruggen Jan 21, 2016
fa08d34
Removed a few frameworks conflicting with AppBuilder LiveSync
EddyVerbruggen Jan 22, 2016
651f360
Implement iOS PHPhotoLibrary authentications
takeo-asai Jun 15, 2016
f1be2b1
Merge pull request #12 from takeo-asai/dev-ios-permissions
EddyVerbruggen Jun 15, 2016
620d139
bump
EddyVerbruggen Jun 15, 2016
3467c34
{Android} Fix width/height parameters
mickaelmagniez Jun 16, 2016
6f72efc
Merge pull request #14 from MickaelMagniez/master
EddyVerbruggen Jun 17, 2016
3bc75db
bump
EddyVerbruggen Jun 17, 2016
fe55db0
Fix localization
MBuchalik Jul 6, 2016
b18a3be
Fixed formatting
MBuchalik Jul 7, 2016
42db1a2
Merge pull request #16 from MBuchalik/master
EddyVerbruggen Jul 30, 2016
7b23195
Update plugin.xml
EddyVerbruggen Jul 30, 2016
6535539
Add option disable_popover
MBuchalik Jul 31, 2016
6cae630
Merge pull request #17 from MBuchalik/master
EddyVerbruggen Jul 31, 2016
d5dc79e
Fixed rotation issue during processing
Ronnnn Aug 3, 2016
3ab8552
Merge pull request #18 from Ronnnn/master
EddyVerbruggen Aug 8, 2016
efed3ad
Update plugin.xml
EddyVerbruggen Aug 9, 2016
e14a76b
Remove line ending for base64 encoding on iOS
sereysethy Dec 20, 2016
19450d8
Merge pull request #1 from sereysethy/base64-no-line-ending
sereysethy Dec 20, 2016
a3278ad
Merge pull request #30 from sereysethy/master
EddyVerbruggen Dec 20, 2016
290375d
bump
EddyVerbruggen Dec 26, 2016
589bb15
iOS 10 - Missing description
Dec 27, 2016
3618c28
add variable $PHOTO_LIBRARY_USAGE_DESCRIPTION
Dec 27, 2016
3931f21
change readme
Dec 27, 2016
8f12ca2
Merge pull request #31 from tkisme/patch-1
EddyVerbruggen Dec 27, 2016
b904b4c
Update plugin.xml
EddyVerbruggen Dec 27, 2016
2588413
use Base64.NO_WRAP
xueron Feb 20, 2017
1d45330
Merge pull request #38 from xueron/xueron-base64
EddyVerbruggen Feb 20, 2017
4af94ff
add chinese simple transl
Mar 18, 2017
e1a52c6
add maximumImagesCount feature for ios platform
Mar 21, 2017
32790fa
gradle fix
fritsstegmann May 29, 2017
41cebcd
Create package.json
kunalmestri9 May 29, 2017
bfaf942
Merge pull request #59 from kunalmestri9/master
EddyVerbruggen Jun 4, 2017
88fa03b
Update package.json
EddyVerbruggen Jun 4, 2017
75094fe
Polish translation
bartcich Jun 4, 2017
bc6c15f
Fix for #64
EddyVerbruggen Jun 25, 2017
d7f9582
bump
EddyVerbruggen Jun 25, 2017
4378605
bump
EddyVerbruggen Jun 25, 2017
ab04fcf
Merge pull request #58 from fstegmann/master
EddyVerbruggen Jul 12, 2017
d74ff09
Added npmignore
EddyVerbruggen Jul 25, 2017
962e2ba
Merge pull request #48 from zhaolin0801/master
EddyVerbruggen Aug 3, 2017
cc2df6b
Add German translations
Aug 26, 2017
aa1c3ca
fixed java.lang.NullPointerException
kuwabarahiroshi Aug 30, 2016
66000a6
Merge pull request #84 from kuwabarahiroshi/fix/issues-26
EddyVerbruggen Oct 31, 2017
161e43d
fixed installation failure with cordova-android >= 7
Mar 9, 2018
a2bbe4d
changed plugin id
Mar 12, 2018
9404330
Revert "changed plugin id"
Mar 12, 2018
c8c84e1
Merge pull request #108 from vonvonme/master
EddyVerbruggen Mar 16, 2018
2a9dbb8
bump
EddyVerbruggen Mar 16, 2018
1aa7ec1
fix platforms\android\app\src\main\java\com\synconset\ImageFetcher.ja…
cvaliere Mar 20, 2018
6865f61
Merge pull request #110 from BeMyEye/master
EddyVerbruggen Mar 20, 2018
bace1e4
bump
EddyVerbruggen Mar 20, 2018
da2f781
Fixed id
Sjerd Apr 17, 2018
caab254
Fixed package.json
Sjerd Apr 17, 2018
5d2fe3a
Fixed id and install script
Sjerd Apr 17, 2018
0d10d16
Removed repo tag from package.json
Sjerd Apr 17, 2018
e3a8cbd
Merge pull request #114 from Sjerd/master
EddyVerbruggen May 28, 2018
c4c88ab
Merge pull request #76 from pandacoustic/android-add-german-translations
EddyVerbruggen May 28, 2018
5bb1380
Merge branch 'master' into pl-translation
EddyVerbruggen May 28, 2018
55a5df5
Merge pull request #61 from bartcich/pl-translation
EddyVerbruggen May 28, 2018
77134ba
bump
EddyVerbruggen May 28, 2018
118d158
Update plugin.xml
robpaveza May 31, 2018
66262cd
Merge pull request #125 from robpaveza/master
EddyVerbruggen Jun 2, 2018
c76127d
bump
EddyVerbruggen Jun 2, 2018
e460722
Fire cancel event from ios
ArcadeMode Jun 26, 2018
bc4929d
small fix
ArcadeMode Jun 26, 2018
581789e
Add failure callback when cannot request read permission on iOS
quangpdt Jun 27, 2018
9e177d4
Bump version
quangpdt Jun 27, 2018
6d0be44
Bump version for establishing on NPM
quangpdt Jun 27, 2018
9a720e2
Back to telerik plugin info for pull request
quangpdt Jun 27, 2018
eeadc51
Merge pull request #130 from quangpdt/merge-with-telerik
EddyVerbruggen Jun 27, 2018
ab2c47b
Add failureCallback in parameters
quangpdt Jun 27, 2018
5f5a5be
Merge pull request #1 from Telerik-Verified-Plugins/master
quangpdt Jun 27, 2018
30aa389
Merge pull request #131 from quangpdt/merge-with-telerik
EddyVerbruggen Jun 27, 2018
f2e0552
bump
EddyVerbruggen Jun 27, 2018
4e2863f
sometimes cancel would still not send an event
ArcadeMode Jun 29, 2018
3d42686
Prevents crashing when Importing in the non-default Orientation of app
dimitriadamou Jul 2, 2018
318dfcf
Add Japanese Language Support.
hayashizaki-masayuki Aug 30, 2018
948b2bd
Merge pull request #132 from dimitriadamou/master
EddyVerbruggen Jan 10, 2019
69f6ec3
bump
EddyVerbruggen Jan 18, 2019
b72c376
Merge pull request #128 from ArcadeMode/master
EddyVerbruggen Feb 18, 2019
fee1ef3
bump
EddyVerbruggen Feb 18, 2019
dc70f4e
Merge pull request #138 from sakaitaka/add_japanese_language_support
EddyVerbruggen Feb 18, 2019
ffbbb7b
Added missing spanish translations(#146) and adjusted discard/ok butt…
hyeritsyan Mar 5, 2019
d44098d
Fix android TransactionTooLargeException
hkjeffchan Mar 11, 2019
2d9ed07
add ResultIPC.java to plugin.xml
hkjeffchan Mar 20, 2019
c34e17b
Merge pull request #150 from hkjeffchan/master
EddyVerbruggen Mar 21, 2019
a53f9b5
bump
EddyVerbruggen Mar 21, 2019
957c0df
Merge pull request #149 from okode/translations-spanish
EddyVerbruggen Mar 26, 2019
490d90b
bump
EddyVerbruggen Mar 26, 2019
6a40fc9
Fix typos in the German translation
uaza Mar 27, 2019
9f41af3
Merge pull request #153 from uaza/master
EddyVerbruggen Mar 27, 2019
4a8e6f6
bump
EddyVerbruggen Mar 27, 2019
e26ca86
Fix - https://github.com/Telerik-Verified-Plugins/ImagePicker/issues/95
anujraghuvanshi Apr 29, 2019
6c52270
Fix- https://github.com/Telerik-Verified-Plugins/ImagePicker/issues/95
anujraghuvanshi Apr 29, 2019
ce7ce9d
Fix - https://github.com/Telerik-Verified-Plugins/ImagePicker/issues/143
anujraghuvanshi Apr 29, 2019
16244b5
Merge pull request #155 from Anuj-Raghuvanshi/master
anujraghuvanshi Apr 30, 2019
9a0d78b
Bumped App version.
Anuj-logiciel Jun 20, 2019
5140a7b
Fix - #86 Support Library configuration Android
virkinia Jul 18, 2019
57f1187
Merge pull request #159 from virkinia/patch-1
anujraghuvanshi Sep 10, 2019
bbc1631
Fix - (#157)
pcsantana Nov 6, 2019
94f0aac
Added browser support (#172)
fefc Nov 28, 2019
cc8d784
add loading show for downloading cloud image
AndySSSSSS Jan 13, 2020
0e23653
Delete UIColor+flat.h
AndySSSSSS Jan 13, 2020
614ecdc
Delete UIColor+flat.m
AndySSSSSS Jan 13, 2020
19d4d0e
add loading gif for downloading ios cloud image
AndySSSSSS Jan 13, 2020
c73394e
Added italian support (#189)
L043N70 Feb 29, 2020
45de51e
Revert "Added italian support (#189)"
Anuj-logiciel Mar 3, 2020
b4edc6a
Revert "Revert "Added italian support (#189)""
Anuj-logiciel Mar 3, 2020
ecf2c79
Fix Issue - (#191)
CaioMelo8 Mar 3, 2020
5cde5e6
added missing Polish translations
jarosy Apr 15, 2020
e0bd861
Merge pull request #194 from jarosy/master
EddyVerbruggen Apr 15, 2020
f59b593
Update plugin.xml
AndySSSSSS May 21, 2020
9922016
Fixes crashes when localizedTitle is nil for album
sithwarrior Jul 28, 2020
9e78427
Merge pull request #207 from sithwarrior/master
EddyVerbruggen Jul 28, 2020
307749d
bump
EddyVerbruggen Jul 28, 2020
b113085
support android 10 (API 29)
eliadAfeka Aug 4, 2020
43378d2
Update plugin.xml
eliadAfeka Aug 5, 2020
94759d7
Update plugin.xml
eliadAfeka Aug 5, 2020
8734034
Update plugin.xml
anujraghuvanshi Aug 5, 2020
6a697a8
Merge pull request #210 from eliadAfeka/master
anujraghuvanshi Aug 5, 2020
e3fa1c5
fix broken import in capacitor
gnesher Aug 30, 2020
c7c866c
Merge pull request #213 from gnesher/fix-imports
EddyVerbruggen Aug 30, 2020
97c67ff
Merge pull request #181 from AndySSSSSS/master
erikramalho Dec 2, 2020
b705b06
Update package.json
erikramalho Dec 2, 2020
802cc75
Fix Issue - (#227)
anujraghuvanshi Feb 17, 2021
bbcfe6b
Revert #210
anujraghuvanshi Feb 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
xcuserdata/
project.xcworkspace/
tags
.idea
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
demo
113 changes: 78 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ Cordova Plugin For Multiple Image Selection - implemented for iOS and Android 4.
The plugin conforms to the Cordova plugin specification, it can be installed
using the Cordova / Phonegap command line interface.

phonegap plugin add https://github.com/wymsee/cordova-imagePicker.git
# 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/wymsee/cordova-imagePicker.git
cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"


## Using the plugin
Expand All @@ -20,54 +25,92 @@ The plugin creates the object `window.imagePicker` with the method `getPictures(
Example - Get Full Size Images (all default options):
```javascript
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);
}
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:
```javascript
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
}
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 = {
// 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)
// 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

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.
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.

```js
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

Expand Down Expand Up @@ -109,4 +152,4 @@ 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.
THE SOFTWARE.
53 changes: 53 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>ImagePicker demo</title>
</head>
<body>
<div class="app">
<h1>ImagePicker demo</h1>

<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>

<p class="event received">Device is Ready</p>
<button onclick="getPics()">get pics</button>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script>
function getPics() {
imagePicker.getPictures(
function (result) {
var content = '';
for (var i = 0; i < result.length; i++) {
content += '<img src="' + result[i] + '" style="max-width:200px"/>';
//content += '<img src="data:image/jpg;base64,'+result[i]+'" style="max-width:200px"/>';
}
document.getElementById("imageOutput").innerHTML = content;
}, function (error) {
alert('Error: ' + error);
}, {
// if no title is passed, the plugin should use a sane default (preferrably the same as it was, so check the old one.. there are screenshots in the marketplace doc)
maximumImagesCount: 10,
title: 'Select pix',
message: 'Pick max 10 items', // optional default no helper message above the picker UI
// be careful with these options as they require additional processing
width: 400,
quality: 80
// outputType: imagePicker.OutputType.BASE64_STRING
}
);
}
</script>

<div id="imageOutput">
</div>

</body>
</html>
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "2.3.6",
"name": "cordova-plugin-telerik-imagepicker",
"cordova_name": "ImagePicker",
"description": "This plugin allows selection of multiple images from the camera roll / gallery in a phonegap app",
"license": "MIT",
"issue": "",
"keywords": [],
"platforms": [
"android",
"ios"
],
"cordova": {
"id": "cordova-plugin-telerik-imagepicker",
"platforms": [
"ios",
"android",
"wp8"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/Telerik-Verified-Plugins/ImagePicker.git"
},
"engines": {
"name": "cordova",
"version": ">=3.5.0"
}
}
Loading