|
|
@@ -521,10 +521,18 @@ public class KingfisherManager {
|
|
|
result.match(
|
|
|
onSuccess: { cacheResult in
|
|
|
let value: Result<RetrieveImageResult, KingfisherError>
|
|
|
- if let image = cacheResult.image {
|
|
|
+ if var image = cacheResult.image {
|
|
|
+ if image.kf.imageFrameCount != nil && image.kf.imageFrameCount != 1, let data = image.kf.animatedImageData {
|
|
|
+ // Always recreate animated image representation since it is possible to be loaded in different options.
|
|
|
+ // https://github.com/onevcat/Kingfisher/issues/1923
|
|
|
+ image = KingfisherWrapper.animatedImage(data: data, options: options.imageCreatingOptions) ?? .init()
|
|
|
+ }
|
|
|
+ if let modifier = options.imageModifier {
|
|
|
+ image = modifier.modify(image)
|
|
|
+ }
|
|
|
value = result.map {
|
|
|
RetrieveImageResult(
|
|
|
- image: options.imageModifier?.modify(image) ?? image,
|
|
|
+ image: image,
|
|
|
cacheType: $0.cacheType,
|
|
|
source: source,
|
|
|
originalSource: context.originalSource
|