I want to know the size of image taken by UIImagePickerController
by camara or library. Is there any way to find that ?
Requirement is like,
If
If you have a path like jinx said, you could do this
NSNumber *theFileSize = [NSNumber numberWithInt:0];
NSFileManager * filemanager = [NSFileManager defaultManager];
if([filemanager fileExistsAtPath:fullFilePath])
{
NSDictionary * attributes = [filemanager attributesOfItemAtPath:fullFilePath error:nil];
theFileSize = [attributes objectForKey:NSFileSize];
}
[self convertbyteToKB_MB:[theFileSize intValue];
...
-(NSString*)convertbyteToKB_MB:(int)byte
{
NSString *retSize = [NSString stringWithFormat:@"%d bytes",byte];
float fByte = byte;
if (byte > 1024)
{
//Kilobytes
fByte = fByte / 1024;
retSize = [NSString stringWithFormat:@"%.1f KB",fByte];
}
if (fByte > 1024)
{
//Megabytes
fByte = fByte / 1024;
retSize = [NSString stringWithFormat:@"%.1f MB",fByte];
}
return retSize;
}