mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 11:02:48 +02:00
Merge branch 'app-extension-improvements' of https://github.com/aramsargsyan/riot-ios into app-extension-improvements
This commit is contained in:
@@ -395,9 +395,18 @@ typedef NS_ENUM(NSInteger, ImageCompressionMode)
|
||||
}
|
||||
return;
|
||||
}
|
||||
//Send the image
|
||||
|
||||
// Prepare the image
|
||||
BOOL rotated = NO;
|
||||
UIImage *image = [[UIImage alloc] initWithData:imageData];
|
||||
|
||||
// Make sure the uploaded image orientation is up
|
||||
if (image.imageOrientation != UIImageOrientationUp)
|
||||
{
|
||||
image = [MXKTools forceImageOrientationUp:image];
|
||||
rotated = YES;
|
||||
}
|
||||
|
||||
if (self.imageCompressionMode == ImageCompressionModeSmall)
|
||||
{
|
||||
image = [MXKTools reduceImage:image toFitInSize:CGSizeMake(MXKTOOLS_SMALL_IMAGE_SIZE, MXKTOOLS_SMALL_IMAGE_SIZE)];
|
||||
@@ -415,14 +424,27 @@ typedef NS_ENUM(NSInteger, ImageCompressionMode)
|
||||
if ([itemProvider hasItemConformingToTypeIdentifier:(__bridge NSString *)kUTTypePNG])
|
||||
{
|
||||
mimeType = @"image/png";
|
||||
|
||||
if (rotated)
|
||||
{
|
||||
// Update imageData
|
||||
imageData = UIImagePNGRepresentation(image);
|
||||
}
|
||||
}
|
||||
else if ([itemProvider hasItemConformingToTypeIdentifier:(__bridge NSString *)kUTTypeJPEG])
|
||||
{
|
||||
mimeType = @"image/jpeg";
|
||||
|
||||
if (rotated)
|
||||
{
|
||||
// Update imageData
|
||||
imageData = UIImageJPEGRepresentation(image, 1.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
image = [[UIImage alloc] initWithData:UIImageJPEGRepresentation(image, 1.0)];
|
||||
imageData = UIImageJPEGRepresentation(image, 1.0);
|
||||
image = [[UIImage alloc] initWithData:imageData];
|
||||
mimeType = @"image/jpeg";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user