|
@ -267,10 +267,18 @@ static char imageURLKey;
|
267
|
267
|
}
|
268
|
268
|
}
|
269
|
269
|
if ([imgUrl hasPrefix:@"file:"]) {//本地图片
|
270
|
|
NSData *data = [NSData dataWithContentsOfFile:imgUrl];
|
271
|
|
UIImage *image = [UIImage imageWithData:data];
|
272
|
|
//图片保存到相册
|
273
|
|
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
|
|
270
|
NSArray *arr = [imgUrl componentsSeparatedByString:@"/Library"];
|
|
271
|
if (arr.count==2) {
|
|
272
|
NSString *myurl = [NSString stringWithFormat:@"%@%@",@"/Library",arr[1]];
|
|
273
|
imgUrl = [NSHomeDirectory() stringByAppendingString:myurl];
|
|
274
|
}
|
|
275
|
NSFileManager *manager = [[NSFileManager alloc] init];
|
|
276
|
if ([manager fileExistsAtPath:imgUrl]) {
|
|
277
|
NSData *data = [NSData dataWithContentsOfFile:imgUrl];
|
|
278
|
UIImage *image = [UIImage imageWithData:data];
|
|
279
|
//图片保存到相册
|
|
280
|
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
|
|
281
|
}
|
274
|
282
|
}
|
275
|
283
|
}
|
276
|
284
|
/*
|
|
@ -278,7 +286,7 @@ static char imageURLKey;
|
278
|
286
|
*/
|
279
|
287
|
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
|
280
|
288
|
{
|
281
|
|
NSLog(@"image = %@, error = %@, contextInfo = %@", image, error, contextInfo);
|
|
289
|
[super callback:@"0"];
|
282
|
290
|
}
|
283
|
291
|
|
284
|
292
|
@end
|