Skip to content

Commit

Permalink
Add a custom value to allow you to configure the compression rate for…
Browse files Browse the repository at this point in the history
… images
  • Loading branch information
steve committed Aug 5, 2011
1 parent 27c8306 commit 166be4c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Classes/ShareKit/Sharers/Actions/Email/SHKMail.m
Expand Up @@ -171,8 +171,13 @@ - (BOOL)sendMail
if (item.data)
[mailController addAttachmentData:item.data mimeType:item.mimeType fileName:item.filename];

if (item.image)
[mailController addAttachmentData:UIImageJPEGRepresentation(item.image, 1) mimeType:@"image/jpeg" fileName:@"Image.jpg"];
if (item.image){
float jpgQuality = 1;
if ([item customValueForKey:@"jpgQuality"] != nil) {
jpgQuality = [[item customValueForKey:@"jpgQuality"] floatValue];
}
[mailController addAttachmentData:UIImageJPEGRepresentation(item.image, jpgQuality) mimeType:@"image/jpeg" fileName:@"Image.jpg"];
}

[mailController setSubject:item.title];
[mailController setMessageBody:body isHTML:YES];
Expand Down

0 comments on commit 166be4c

Please sign in to comment.