https://github.com/remirobert/imagedownloader
UIImage downloader from url with cache.
https://github.com/remirobert/imagedownloader
Last synced: over 1 year ago
JSON representation
UIImage downloader from url with cache.
- Host: GitHub
- URL: https://github.com/remirobert/imagedownloader
- Owner: remirobert
- License: mit
- Created: 2014-10-12T14:34:26.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-10-13T10:53:11.000Z (over 11 years ago)
- Last Synced: 2025-01-11T06:13:18.883Z (over 1 year ago)
- Language: Swift
- Size: 148 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ImageDownloader
ImageDownloader allows you to download image from url on asynchronous thread.
All images after download are stored in memory.
The next time the image will be loaded from the disk, it's faster ! Very usefull for a photo app, or social app like Facebook.
ImageDownloader uses **MD5** for store the image according to the url.
For use ImageDownloader, you have to add the following line to your **Bridging Header**:
```Objective-c
#import
```
How to use it
Use the block completion for get the UIImage and do whatever you want with it.
```Swift
let urlImage = "http://fc01.deviantart.net/fs70/i/2014/284/2/0/raiden_by_keprion-d82epij.jpg"
ImageDownloader.downloadImage(urlImage: urlImage) { (imageDownloaded) -> () in
imageView.image = imageDownloaded
}
```
You can use a another method for fit the UIImage with a size:
```Swift
ImageDownloader.downloadImageWithSize(urlImage: "http://fc01.deviantart.net/fs70/i/2014/284/2/0/raiden_by_keprion-d82epij.jpg", sizeImage: CGSizeMake(200, 200))
{ (imageDownloaded) -> () in
imageView.image = imageDownloaded
imageView.contentMode = UIViewContentMode.ScaleAspectFill
}
```
You can use a UIImageView extension for download a image as well. The image will be displayed on the UIImageView automatically after completion.
```Swift
imageView.downloadImage("http://fc01.deviantart.net/fs70/i/2014/284/2/0/raiden_by_keprion-d82epij.jpg")
```
Author
Rémi ROBERT, remirobert33530@gmail.com
ImageDownloader is available under the MIT license. See the LICENSE file for more info.