Skip to content

Commit

Permalink
Convert unknown file types to JPEG (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
fubar authored and ivpusic committed Jul 1, 2018
1 parent 88a03f5 commit 3059918
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ios/src/ImageCropPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,16 @@ - (void)qb_imagePickerController:
NSNumber *maxHeight = [self.options valueForKey:@"compressImageMaxHeight"];
Boolean useOriginalHeight = (maxHeight == nil || [maxHeight integerValue] >= imgT.size.height);

NSString *mimeType = [self determineMimeTypeFromImageData:imageData];
Boolean isKnownMimeType = [mimeType length] > 0;

ImageResult *imageResult = [[ImageResult alloc] init];
if (isLossless && useOriginalWidth && useOriginalHeight) {
if (isLossless && useOriginalWidth && useOriginalHeight && isKnownMimeType) {
// Use original, unmodified image
imageResult.data = imageData;
imageResult.width = @(imgT.size.width);
imageResult.height = @(imgT.size.height);
imageResult.mime = [self determineMimeTypeFromImageData:imageData];
imageResult.mime = mimeType;
imageResult.image = imgT;
} else {
imageResult = [self.compression compressImage:[imgT fixOrientation] withOptions:self.options];
Expand Down

0 comments on commit 3059918

Please sign in to comment.