@@ -33,15 +33,15 @@ - (void) getPictures:(CDVInvokedUrlCommand *)command {
3333
3434 // Create the an album controller and image picker
3535 ELCAlbumPickerController *albumController = [[ELCAlbumPickerController alloc ] init ];
36-
36+
3737 if (maximumImagesCount == 1 ) {
3838 albumController.immediateReturn = true ;
3939 albumController.singleSelection = true ;
4040 } else {
4141 albumController.immediateReturn = false ;
4242 albumController.singleSelection = false ;
4343 }
44-
44+
4545 ELCImagePickerController *imagePicker = [[ELCImagePickerController alloc ] initWithRootViewController: albumController];
4646 imagePicker.maximumImagesCount = maximumImagesCount;
4747 imagePicker.returnsOriginalImage = 1 ;
@@ -75,11 +75,11 @@ - (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPic
7575 do {
7676 filePath = [NSString stringWithFormat: @" %@ /%@ %03d .%@ " , docsPath, CDV_PHOTO_PREFIX, i++, @" jpg" ];
7777 } while ([fileMgr fileExistsAtPath: filePath]);
78-
78+
7979 @autoreleasepool {
8080 ALAssetRepresentation *assetRep = [asset defaultRepresentation ];
8181 CGImageRef imgRef = NULL ;
82-
82+
8383 // defaultRepresentation returns image as it appears in photo picker, rotated and sized,
8484 // so use UIImageOrientationUp when creating our image below.
8585 if (picker.returnsOriginalImage ) {
@@ -88,15 +88,15 @@ - (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPic
8888 } else {
8989 imgRef = [assetRep fullScreenImage ];
9090 }
91-
91+
9292 UIImage* image = [UIImage imageWithCGImage: imgRef scale: 1 .0f orientation: orientation];
9393 if (self.width == 0 && self.height == 0 ) {
9494 data = UIImageJPEGRepresentation (image, self.quality /100 .0f );
9595 } else {
9696 UIImage* scaledImage = [self imageByScalingNotCroppingForSize: image toSize: targetSize];
9797 data = UIImageJPEGRepresentation (scaledImage, self.quality /100 .0f );
9898 }
99-
99+
100100 if (![data writeToFile: filePath options: NSAtomicWrite error: &err]) {
101101 result = [CDVPluginResult resultWithStatus: CDVCommandStatus_IO_EXCEPTION messageAsString: [err localizedDescription ]];
102102 break ;
@@ -110,7 +110,7 @@ - (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPic
110110 }
111111
112112 }
113-
113+
114114 if (nil == result) {
115115 result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsArray: resultStrings];
116116 }
@@ -153,7 +153,7 @@ - (UIImage*)imageByScalingNotCroppingForSize:(UIImage*)anImage toSize:(CGSize)fr
153153 } else {
154154 scaleFactor = widthFactor; // scale to fit width
155155 }
156- scaledSize = CGSizeMake (width * scaleFactor, height * scaleFactor);
156+ scaledSize = CGSizeMake (floor ( width * scaleFactor), floor ( height * scaleFactor) );
157157 }
158158
159159 UIGraphicsBeginImageContext (scaledSize); // this will resize
0 commit comments