|
@ -62,7 +62,6 @@ struct InnerProfilePicView: View { |
|
|
.placeholder { _ in |
|
|
.placeholder { _ in |
|
|
Placeholder |
|
|
Placeholder |
|
|
} |
|
|
} |
|
|
.cacheOriginalImage() |
|
|
|
|
|
.scaleFactor(UIScreen.main.scale) |
|
|
.scaleFactor(UIScreen.main.scale) |
|
|
.loadDiskFileSynchronously() |
|
|
.loadDiskFileSynchronously() |
|
|
.fade(duration: 0.1) |
|
|
.fade(duration: 0.1) |
|
@ -112,17 +111,20 @@ struct LargeImageProcessor: ImageProcessor { |
|
|
let downsampleSize = CGSize(width: 200, height: 200) |
|
|
let downsampleSize = CGSize(width: 200, height: 200) |
|
|
|
|
|
|
|
|
func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? { |
|
|
func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? { |
|
|
let downsamplingImageProcessor = DownsamplingImageProcessor(size: downsampleSize) |
|
|
|
|
|
|
|
|
|
|
|
switch item { |
|
|
switch item { |
|
|
case .image(let image): |
|
|
case .image(let image): |
|
|
if image.cacheCost > maxSize { |
|
|
guard let data = image.kf.data(format: .unknown) else { |
|
|
return downsamplingImageProcessor.process(item: item, options: options) |
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if data.count > maxSize { |
|
|
|
|
|
return KingfisherWrapper.downsampledImage(data: data, to: downsampleSize, scale: options.scaleFactor) |
|
|
} |
|
|
} |
|
|
return image |
|
|
return image |
|
|
case .data(let data): |
|
|
case .data(let data): |
|
|
if data.count > maxSize { |
|
|
if data.count > maxSize { |
|
|
return downsamplingImageProcessor.process(item: item, options: options) |
|
|
return KingfisherWrapper.downsampledImage(data: data, to: downsampleSize, scale: options.scaleFactor) |
|
|
} |
|
|
} |
|
|
return KFCrossPlatformImage(data: data) |
|
|
return KFCrossPlatformImage(data: data) |
|
|
} |
|
|
} |
|
|