Nuke
                                
                                 Nuke copied to clipboard
                                
                                    Nuke copied to clipboard
                            
                            
                            
                        Disk image cache looses the information about image orientation
Hi
I found a strange bug that I can not avoid.
I need both images for my task. The original one and a smaller preview. I find out that if I save that preview manually when it is being restored from the disk cache may loose its orientation.
A bit of background. If you rotate an image lets say 90 degree in the gallery app, the ios wont resample it, it will just add another orientation value to its metadata and present it according to its value.
If I download such image it has that metadata inside. ImageProcessors.Resize(width: 300).process(response.image) doesn't loose the orientation information either. So if I cache the preview image it is presented correctly up until I reboot the app. So it mean that the orientation is correctly saved in the memory cache, but it is being lost on the next start of the app when the preview image is restored from the image cache.
The example code that you can test is below:
            let resizingRequest = ImageRequest(url: imageURL, processors: [ImageProcessors.Resize(width: 300)], priority: .high)
            if let image = ImagePipeline.shared.cache.cachedImage(for: resizingRequest)?.image {
                self.image = image // After the restart the orientation
                print("\(image.imageOrientation.rawValue)")
            } else {
                ImagePipeline.shared.loadImage(with: imageURL, completion: { [weak self] result in
                    guard let self = self,
                          case let .success(response) = result,
                          let previewImage = ImageProcessors.Resize(width: 300).process(response.image),
                          let cgPreviewImage = previewImage.cgImage else {
                        return
                    }
                    print("\(previewImage.imageOrientation.rawValue)")
                    ImagePipeline.shared.cache.storeCachedImage(ImageContainer(image: previewImage), for: resizingRequest)
//                     ImagePipeline.shared.cache.storeCachedImage(ImageContainer(image: UIImage(cgImage: cgPreviewImage, scale: response.image.scale, orientation: response.image.imageOrientation)), for: resizingRequest)
                    self.image = image
                })
            }
Hi, have you found a solution? Can you please provide an image URL with which you can reproduce it?
Fixed in Nuke 11.6.0 (update: pulled from GitHub temporarily)
I also have the same problem. @kean Where can I find 11.6.0 version?
@Madrox24, version 11.6.0 is now available