UIImage to base64 String Encoding

后端 未结 7 1711
囚心锁ツ
囚心锁ツ 2020-12-01 01:04

How to convert UIimage to base64 encoded string? I couldn\'t find any examples or codes with detailed regarding.

相关标签:
7条回答
  • 2020-12-01 01:32

    when converting to image to base64 in ios the new line “\n” from base64 encoded strings :

    use this code :

    
     UIImage* orginalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
    
    
    
            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:isRowIndex inSection:isSectionIndex] ;
    
            UITableViewCell *cell = [jobstable cellForRowAtIndexPath:indexPath];
    
            UIImageView *tableIMAGE=(UIImageView *)[cell.contentView viewWithTag:19];
    
            tableIMAGE.image=orginalImage;
    
    
    
    imageStris = [UIImageJPEGRepresentation(tableIMAGE.image,1)base64Encoding];
    
    answersARRAY[indexPath.row] = [NSString stringWithFormat:@"-1,%@,%@",answersARRAY[indexPath.row],imageStris];
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
    
    
    
    0 讨论(0)
提交回复
热议问题