From 8416d56692d10b3338738bae2576bca6c99226fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=B9=E4=B8=8A=E4=B9=8B=E9=9C=9C?= Date: Thu, 20 Jul 2017 15:38:06 +0800 Subject: [PATCH] [iOS] Fix a bug that cause a {0,0} size image -[origin] if ([maxWidth integerValue] == 0 || [maxHeight integerValue] == 0) { -when pick a width< height image and only set "compressImageMaxWidth",will cause a {0,0}size image -Now fix it --- ios/Compression.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ios/Compression.m b/ios/Compression.m index 5ce68a0..f7ac1b7 100644 --- a/ios/Compression.m +++ b/ios/Compression.m @@ -34,8 +34,11 @@ NSNumber *maxWidth = [options valueForKey:@"compressImageMaxWidth"]; NSNumber *maxHeight = [options valueForKey:@"compressImageMaxHeight"]; ImageResult *result = [[ImageResult alloc] init]; - - if ([maxWidth integerValue] == 0 || [maxWidth integerValue] == 0) { + + //[origin] if ([maxWidth integerValue] == 0 || [maxHeight integerValue] == 0) { + //when pick a width< height image and only set "compressImageMaxWidth",will cause a {0,0}size image + //Now fix it + if ([maxWidth integerValue] == 0 || [maxHeight integerValue] == 0) { result.width = [NSNumber numberWithFloat:image.size.width]; result.height = [NSNumber numberWithFloat:image.size.height]; result.image = image;