diff --git a/clients/ios/Classes/NewsBlurViewController.m b/clients/ios/Classes/NewsBlurViewController.m index 93c585905..834bb6115 100644 --- a/clients/ios/Classes/NewsBlurViewController.m +++ b/clients/ios/Classes/NewsBlurViewController.m @@ -1796,7 +1796,7 @@ heightForHeaderInSection:(NSInteger)section { // adding user avatar to left NSURL *imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@", [appDelegate.dictSocialProfile - objectForKey:@"photo_url"]]]; + objectForKey:@"large_photo_url"]]]; userAvatarButton = [UIBarButtonItem barItemWithImage:[UIImage alloc] target:self action:@selector(showUserProfile)]; @@ -1806,8 +1806,10 @@ heightForHeaderInSection:(NSInteger)section { [avatarRequest setHTTPShouldHandleCookies:NO]; [avatarRequest setHTTPShouldUsePipelining:YES]; UIImageView *avatarImageView = [[UIImageView alloc] initWithFrame:userAvatarButton.customView.frame]; + CGSize avatarSize = avatarImageView.frame.size; [avatarImageView setImageWithURLRequest:avatarRequest placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { - image = [Utilities roundCorneredImage:image radius:3]; + image = [Utilities imageWithImage:image convertToSize:CGSizeMake(avatarSize.width*2, avatarSize.height*2)]; + image = [Utilities roundCorneredImage:image radius:6]; [(UIButton *)userAvatarButton.customView setImage:image forState:UIControlStateNormal]; } failure:nil]; // self.navigationItem.leftBarButtonItem = userInfoBarButton; diff --git a/clients/ios/Classes/Utilities.h b/clients/ios/Classes/Utilities.h index 13aa077a1..8d66499ce 100644 --- a/clients/ios/Classes/Utilities.h +++ b/clients/ios/Classes/Utilities.h @@ -21,6 +21,7 @@ void drawLinearGradient(CGContextRef context, CGRect rect, CGColorRef startColor + (void)drawLinearGradientWithRect:(CGRect)rect startColor:(CGColorRef)startColor endColor:(CGColorRef)endColor; + (void)saveimagesToDisk; + (UIImage *)roundCorneredImage:(UIImage *)orig radius:(CGFloat)r; ++ (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size; + (NSString *)md5:(NSString *)string; + (NSString *)formatLongDateFromTimestamp:(NSInteger)timestamp; + (NSString *)formatShortDateFromTimestamp:(NSInteger)timestamp; diff --git a/clients/ios/Classes/Utilities.m b/clients/ios/Classes/Utilities.m index 90626d3d0..d825a836f 100644 --- a/clients/ios/Classes/Utilities.m +++ b/clients/ios/Classes/Utilities.m @@ -141,6 +141,14 @@ static NSMutableDictionary *imageCache; return result; } ++ (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size { + UIGraphicsBeginImageContext(size); + [image drawInRect:CGRectMake(0, 0, size.width, size.height)]; + UIImage *destImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return destImage; +} + + (NSString *)md5:(NSString *)string { const char *cStr = [string UTF8String]; unsigned char result[16];