Commit 865d46fa authored by yuzheng.tz's avatar yuzheng.tz

新增notScaleImage属性,设置为YES时内部不去缩放图片

parent 557bb3d5
......@@ -553,7 +553,9 @@ static dispatch_once_t onceToken;
options.resizeMode = PHImageRequestOptionsResizeModeFast;
[[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
UIImage *resultImage = [UIImage imageWithData:imageData scale:0.1];
if (![TZImagePickerConfig sharedInstance].notScaleImage) {
resultImage = [self scaleImage:resultImage toSize:imageSize];
}
if (!resultImage) {
resultImage = image;
}
......
......@@ -132,6 +132,10 @@
/// Default is white color with 0.8 alpha;
@property (strong, nonatomic) UIColor *cannotSelectLayerColor;
/// Default is No, if set YES, the result photo will not be scaled to photoWidth pixel width. The photoWidth default is 828px
/// 默认是NO,如果设置为YES,内部不会缩放图片到photoWidth像素宽
@property (assign, nonatomic) BOOL notScaleImage;
/// The photos user have selected
/// 用户选中过的图片数组
@property (nonatomic, strong) NSMutableArray *selectedAssets;
......@@ -330,4 +334,5 @@
@property (assign, nonatomic) NSInteger gifPreviewMaxImagesCount;
@property (assign, nonatomic) BOOL showSelectedIndex;
@property (assign, nonatomic) BOOL showPhotoCannotSelectLayer;
@property (assign, nonatomic) BOOL notScaleImage;
@end
......@@ -271,6 +271,7 @@
self.barItemTextFont = [UIFont systemFontOfSize:15];
self.barItemTextColor = [UIColor whiteColor];
self.allowPreview = YES;
self.notScaleImage = NO;
self.statusBarStyle = UIStatusBarStyleLightContent;
self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];
self.allowCameraLocation = YES;
......@@ -354,6 +355,11 @@
[TZImagePickerConfig sharedInstance].showPhotoCannotSelectLayer = showPhotoCannotSelectLayer;
}
- (void)setNotScaleImage:(BOOL)notScaleImage {
_notScaleImage = notScaleImage;
[TZImagePickerConfig sharedInstance].notScaleImage = notScaleImage;
}
- (void)observeAuthrizationStatusChange {
[_timer invalidate];
_timer = nil;
......
......@@ -386,7 +386,9 @@ static CGFloat itemMargin = 5;
[[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (isDegraded) return;
if (photo) {
if (![TZImagePickerConfig sharedInstance].notScaleImage) {
photo = [[TZImageManager manager] scaleImage:photo toSize:CGSizeMake(tzImagePickerVc.photoWidth, (int)(tzImagePickerVc.photoWidth * photo.size.height / photo.size.width))];
}
[photos replaceObjectAtIndex:i withObject:photo];
}
if (info) [infoArr replaceObjectAtIndex:i withObject:info];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment