+ (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type
{
NSString* fileDirectory = [[[VoiceRecorderBaseVCgetCacheDirectory]stringByAppendingPathComponent:_fileName]stringByAppendingPathExtension:_type];
return fileDirectory;
}
+ (NSString*)getCurrentTimeString
{
NSDateFormatter *dateformat=[[[NSDateFormatter alloc]init]autorelease];
[dateformat setDateFormat:@"yyyyMMddHHmmss"];
return [dateformat stringFromDate:[NSDate date]];
}
-(void)writeJPGToFile:(ChatMessageInfo *)_info
{
NSData *imageData = [NSDatadataWithContentsOfURL:[NSURLURLWithString:_info.networkPath]];
NSString *fileName = [ChatVoiceRecorderVC getCurrentTimeString];
NSString *localFilePath = [ChatVoiceRecorderVC getPathByFileName:fileName ofType:@"jpg"];
[imageData writeToFile:localFilePath atomically:NO];
_info.localPath = localFilePath;
}