我正在做iPhone应用程序。在那我将图像转换为base64字符串。但是,我的问题是在转换为base64字符串之前,我想验证图像大小,好像低于图像大小250x250,如果imaage包含超过250x250或euqal到相同的大小,我想将Alertview放在其他位置,那么仅我需要将图像发送为base64字符串到服务器。请给我您的宝贵建议。提前致谢!我正在下面的代码
for(int img_pos=0;img_pos<[uploadPhotosArray count];img_pos++)
{
[self startIndicator];
conversionImage= [UIImage imageWithContentsOfFile:[uploadPhotosArray objectAtIndex:img_pos]];
NSData *imageData = UIImageJPEGRepresentation(conversionImage,1.0);
[Base64 initialize];
NSString *uploadPhotoEncodedString = [Base64 encode:imageData];
//NSLog(@"Byte Array %d : %@",img_pos,uploadPhotoEncodedString);
[uploadPhotosByteArray addObject:uploadPhotoEncodedString];
}
简单检查
if(image.size.height>=250&&image.size.width>=250)
{
NSLog(@"Convert it");
}
else
{
//alertview
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句