Merge pull request #381 from Howard-Wang-Hao/master

[iOS] Fix  a bug that cause a {0,0} size image
This commit is contained in:
Ivan Pusic 2017-07-20 10:02:47 +02:00 committed by GitHub
commit 391465efcc

View File

@ -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;