mirror of
https://gitee.com/shuto/cordova-imagePicker.git
synced 2026-01-26 00:00:16 +08:00
Simplified full size image logic to take full size whenever height and width are each 0 (the default)
This commit is contained in:
@@ -47,7 +47,6 @@ window.imagePicker.getPictures(
|
||||
console.log('Error: ' + error);
|
||||
}, {
|
||||
maximumImagesCount: 10,
|
||||
fullSizeImage: 0,
|
||||
width: 800
|
||||
}
|
||||
);
|
||||
@@ -60,12 +59,10 @@ options = {
|
||||
maximumImagesCount: int,
|
||||
// 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.
|
||||
fullSizeImage: bool,
|
||||
// whether to return the full size image, defaults to true. If this value
|
||||
// is true, width and height are ignored.
|
||||
width: int,
|
||||
// width to resize image to (if one of height/width is 0, will resize
|
||||
// to fit the other while keeping aspect ratio)
|
||||
// to fit the other while keeping aspect ratio, if both height and width
|
||||
// are 0, the full size image will be returned)
|
||||
height: int,
|
||||
// height to resize image to
|
||||
quality: int (0-100)
|
||||
|
||||
@@ -20,6 +20,5 @@
|
||||
@property (nonatomic, assign) NSInteger width;
|
||||
@property (nonatomic, assign) NSInteger height;
|
||||
@property (nonatomic, assign) NSInteger quality;
|
||||
@property (nonatomic, assign) bool fullSizeImage;
|
||||
|
||||
@end
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
NSDictionary *options = [command.arguments objectAtIndex: 0];
|
||||
|
||||
NSInteger maximumImagesCount = [[options objectForKey:@"maximumImagesCount"] integerValue];
|
||||
self.fullSizeImage = [[options objectForKey:@"fullSizeImage"] boolValue];
|
||||
self.width = [[options objectForKey:@"width"] integerValue];
|
||||
self.height = [[options objectForKey:@"height"] integerValue];
|
||||
self.quality = [[options objectForKey:@"quality"] integerValue];
|
||||
@@ -62,7 +61,7 @@
|
||||
image = [dict objectForKey:UIImagePickerControllerOriginalImage];
|
||||
|
||||
NSData* data = nil;
|
||||
if (self.fullSizeImage == YES) {
|
||||
if (self.width == 0 && self.height == 0) {
|
||||
data = UIImageJPEGRepresentation(image, self.quality/100.0f);
|
||||
} else {
|
||||
CGSize targetSize = CGSizeMake(self.width, self.height);
|
||||
|
||||
@@ -15,10 +15,9 @@ var ImagePicker = function() {
|
||||
* options
|
||||
* .maximumImagesCount - 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.
|
||||
* .fullSizeImage - whether to return the full size image, defaults to true. If this value
|
||||
* is true, width and height are ignored.
|
||||
* .width - width to resize image to (if one of height/width is 0, will resize to fit the
|
||||
* other while keeping aspect ratio)
|
||||
* other while keeping aspect ratio, if both height and width are 0, the full size
|
||||
* image will be returned)
|
||||
* .height - height to resize image to
|
||||
* .quality - quality of resized image, defaults to 100
|
||||
*/
|
||||
@@ -29,7 +28,6 @@ ImagePicker.prototype.getPictures = function(success, fail, options) {
|
||||
|
||||
var params = {
|
||||
maximumImagesCount: options.maximumImagesCount ? options.maximumImagesCount : 15,
|
||||
fullSizeImage: (typeof options.fullSizeImage !== "undefined") ? options.fullSizeImage : 1,
|
||||
width: options.width ? options.width : 0,
|
||||
height: options.height ? options.height : 0,
|
||||
quality: options.quality ? options.quality : 100
|
||||
|
||||
Reference in New Issue
Block a user