Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageDownloader to download to destination #286

Open
Urkman opened this issue Sep 4, 2017 · 3 comments
Open

ImageDownloader to download to destination #286

Urkman opened this issue Sep 4, 2017 · 3 comments
Assignees

Comments

@Urkman
Copy link

Urkman commented Sep 4, 2017

Hello,

is there a way to download an image and save it to a destination using the ImageDownloader?
Something like this:

let destination = DownloadRequest.suggestedDownloadDestination(for: .documentDirectory) Alamofire.download("https://httpbin.org/image/png", to: destination)

With the Power of the ImageDownloader?

Thanks,
Urkman

@jshier
Copy link
Contributor

jshier commented Sep 4, 2017

What "powers" of ImageDownloader do you want to combine with simple image download?

@jshier jshier self-assigned this Sep 4, 2017
@ziogaschr
Copy link

ziogaschr commented Oct 2, 2017

Untested sample code:

let urlCache = URLCache(
  memoryCapacity: 20 * 1024 * 1024, // 20 MB
  diskCapacity: 150 * 1024 * 1024,  // 150 MB
 // maybe set your own path here
 diskPath: "org.alamofire.imagedownloader"
)

let configuration = ImageDownloader.defaultURLSessionConfiguration()
configuration.urlCache = urlCache
                
let imageDownloader = ImageDownloader(
  configuration: configuration,
  imageCache: AutoPurgingImageCache()
)

@MonteMango
Copy link

I am looking forward to this feature. I need to save images in the document directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants