{"action":"created","issue":{"url":"https://api.github.com/repos/rs/SDWebImage/issues/2014","repository_url":"https://api.github.com/repos/rs/SDWebImage","labels_url":"https://api.github.com/repos/rs/SDWebImage/issues/2014/labels{/name}","comments_url":"https://api.github.com/repos/rs/SDWebImage/issues/2014/comments","events_url":"https://api.github.com/repos/rs/SDWebImage/issues/2014/events","html_url":"https://github.com/rs/SDWebImage/issues/2014","id":254972372,"node_id":"MDU6SXNzdWUyNTQ5NzIzNzI=","number":2014,"title":"When I have different transform needs, I need to subclass SDWebImageManager, is this right?","user":{"login":"Josscii","id":6898115,"node_id":"MDQ6VXNlcjY4OTgxMTU=","avatar_url":"https://avatars3.githubusercontent.com/u/6898115?v=4","gravatar_id":"","url":"https://api.github.com/users/Josscii","html_url":"https://github.com/Josscii","followers_url":"https://api.github.com/users/Josscii/followers","following_url":"https://api.github.com/users/Josscii/following{/other_user}","gists_url":"https://api.github.com/users/Josscii/gists{/gist_id}","starred_url":"https://api.github.com/users/Josscii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Josscii/subscriptions","organizations_url":"https://api.github.com/users/Josscii/orgs","repos_url":"https://api.github.com/users/Josscii/repos","events_url":"https://api.github.com/users/Josscii/events{/privacy}","received_events_url":"https://api.github.com/users/Josscii/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2017-09-04T08:40:02Z","updated_at":"2018-06-12T10:47:22Z","closed_at":"2017-09-06T15:40:11Z","author_association":"NONE","body":"In my project, I have to transform same image to serval forms, like cornerRadius = 10 or 15, or blur that image before caching, and of course, I do want to cache it separately, but the only way I found to solve this problem is to write multiple subclass of SDWebImageManager, is there any easy way?\r\n\r\nsample code showed as follows:\r\n\r\n```\r\nclass BlurImageManager: SDWebImageManager {\r\n\r\n    static let shared = BlurImageManager()\r\n    var imageLayer = CALayer()\r\n    \r\n    init() {\r\n        super.init(cache: SDImageCache.init(namespace: \"xxxx\"), downloader: SDWebImageDownloader.shared())\r\n        delegate = self\r\n        imageLayer.contentsGravity = \"resizeAspectFill\"\r\n        imageLayer.cornerRadius = 5\r\n        imageLayer.masksToBounds = true\r\n    }\r\n}\r\n\r\nextension BlurImageManager: SDWebImageManagerDelegate {\r\n    func imageManager(_ imageManager: SDWebImageManager, transformDownloadedImage image: UIImage?, with imageURL: URL?) -> UIImage? {\r\n        let image = image?.blurDarkImage()\r\n        \r\n        let size = CGSize(width: kScreenWidth-20, height: 150)\r\n        \r\n        UIGraphicsBeginImageContextWithOptions(size, false, 0)\r\n        let context = UIGraphicsGetCurrentContext()!\r\n        \r\n        imageLayer.frame.size = size\r\n        imageLayer.contents = image?.cgImage\r\n        \r\n        imageLayer.render(in: context)\r\n        \r\n        let output = UIGraphicsGetImageFromCurrentImageContext()!\r\n        UIGraphicsEndImageContext()\r\n        \r\n        return output\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/rs/SDWebImage/issues/comments/396547381","html_url":"https://github.com/rs/SDWebImage/issues/2014#issuecomment-396547381","issue_url":"https://api.github.com/repos/rs/SDWebImage/issues/2014","id":396547381,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjU0NzM4MQ==","user":{"login":"Josscii","id":6898115,"node_id":"MDQ6VXNlcjY4OTgxMTU=","avatar_url":"https://avatars3.githubusercontent.com/u/6898115?v=4","gravatar_id":"","url":"https://api.github.com/users/Josscii","html_url":"https://github.com/Josscii","followers_url":"https://api.github.com/users/Josscii/followers","following_url":"https://api.github.com/users/Josscii/following{/other_user}","gists_url":"https://api.github.com/users/Josscii/gists{/gist_id}","starred_url":"https://api.github.com/users/Josscii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Josscii/subscriptions","organizations_url":"https://api.github.com/users/Josscii/orgs","repos_url":"https://api.github.com/users/Josscii/repos","events_url":"https://api.github.com/users/Josscii/events{/privacy}","received_events_url":"https://api.github.com/users/Josscii/received_events","type":"User","site_admin":false},"created_at":"2018-06-12T10:47:22Z","updated_at":"2018-06-12T10:47:22Z","author_association":"NONE","body":"@dreampiggy I looked into 5.0 feature, and I got a question, why didn't you query the memory cache using the transformed key [here](https://github.com/rs/SDWebImage/blob/997bf8ff3582c3d9408fe1ec65470595b2f787a4/SDWebImage/SDImageCache.m#L348) ?\r\n\r\n"}}
{"actor":{"display_login":"Josscii"}}