Skip to content

Instantly share code, notes, and snippets.

@koke
Last active April 13, 2016 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koke/b17969fee2ba7e6a5a28859ae34af5e5 to your computer and use it in GitHub Desktop.
Save koke/b17969fee2ba7e6a5a28859ae34af5e5 to your computer and use it in GitHub Desktop.
func old_setResizedImage(withURL url: NSURL) {
let photonUrl = photonize(url: url, forSize: frame.size)
let request = NSMutableURLRequest(URL: photonUrl)
request.HTTPShouldHandleCookies = false
request.addValue("image/*", forHTTPHeaderField: "Accept")
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request) { [weak self] data, response, error in
let scale = UIScreen.mainScreen().scale
guard let data = data,
let image = UIImage(data: data, scale: scale) else {
return
}
self?.image = image
}
task.resume()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment