Add limitBytes arg for UIImage+ForceDecode category

This commit is contained in:
DreamPiggy 2018-04-14 22:33:19 +08:00
parent 7272cf78e5
commit fcfca57463
2 changed files with 14 additions and 1 deletions

View File

@ -31,4 +31,13 @@
*/
+ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image;
/**
Decompress and scale down the provided image and limit bytes
@param image The image to be decompressed
@param bytes The limit bytes size. Provide 0 to use the build-in limit.
@return The decompressed and scaled down image
*/
+ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes;
@end

View File

@ -29,10 +29,14 @@
}
+ (UIImage *)sd_decodedAndScaledDownImageWithImage:(UIImage *)image {
return [self sd_decodedAndScaledDownImageWithImage:image limitBytes:0];
}
+ (UIImage *)sd_decodedAndScaledDownImageWithImage:(UIImage *)image limitBytes:(NSUInteger)bytes {
if (!image) {
return nil;
}
return [SDWebImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:0];
return [SDWebImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:bytes];
}
@end