Skip to content

Commit cba4ab1

Browse files
author
radeva
authored
Merge pull request #114 from abhayastudios/master
Fix aspect ratio issue on iOS & add scaling example to docs
2 parents cdfc62c + 8f4282a commit cba4ab1

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,26 @@ context
7575
7676
> **NOTE**: To request permissions for Android 6+ (API 23+) we use [nativescript-permissions](https://www.npmjs.com/package/nativescript-permissions).
7777
78+
### Process the selection with scaling images to specified dimensions and returning ImageSource object
79+
80+
```
81+
context
82+
.authorize()
83+
.then(function() {
84+
return context.present();
85+
})
86+
.then(function(selection) {
87+
selection.forEach((selectedPhoto) => {
88+
selectedPhoto.getImage({ maxWidth: 500, maxHeight: 500 }) // maintains aspect ratio
89+
.then((imageSource) => {
90+
// process the selected image
91+
});
92+
});
93+
}).catch(function (e) {
94+
// process error
95+
});
96+
```
97+
7898
## API
7999
80100
### Methods

src/imagepicker.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class ImagePickerPH extends ImagePicker {
357357
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(
358358
image,
359359
size,
360-
PHImageContentMode.AspectFill,
360+
PHImageContentMode.AspectFit, // Scales the image so that its larger dimension fits the target size
361361
resizeMode,
362362
(createdImage, data) => {
363363
if (createdImage) {

0 commit comments

Comments
 (0)