Skip to content

Commit

Permalink
Merge pull request ivpusic#381 from Howard-Wang-Hao/master
Browse files Browse the repository at this point in the history
[iOS] Fix  a bug that cause a {0,0} size image
  • Loading branch information
ivpusic authored Jul 20, 2017
2 parents ae0abe8 + 8416d56 commit 391465e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ios/Compression.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ - (ImageResult*) compressImageDimensions:(UIImage*)image
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;
Expand Down

0 comments on commit 391465e

Please sign in to comment.