iOS的远程图片操作框架:DFImageManager

jopen 9年前

Modern iOS framework用于从各种源获取,缓存,处理和加工图片。它采用iOS SDK最新的技术,不改造现有的技术。它提供了一个功能强大的API,可扩展您应用程序的功能。

支持的资源

  • NSURL with http, https, ftp, file, and data schemes
  • PHAsset and NSURL with com.github.kean.photos-kit scheme
  • DFALAsset, ALAsset and NSURL with assets-library scheme

特性

  • Zero config yet immense customization and extensibility.
  • Uses latest advancements in Foundation URL Loading System including NSURLSession that supports SPDY protocol.
  • Extreme performance even on outdated devices. Completely asynchronous and thread safe. Performance-critical subsystems run entirely on the background threads.
  • Instead of reinventing a caching methodology it relies on HTTP cache as defined in HTTP specification and caching implementation provided by Foundation URL Loading System. The caching and revalidation are completely transparent to the client. Read more
  • Memory cache layer that stores decompressed and processed images with fine grained control.
  • Centralized image decompression, resizing and processing. Image resizing results in a lack of misaligned images and lower memory footprint. Image processing is fully customizable.
  • Automatic preheating of images that are close to the viewport.
  • Groups same requests and never executes them twice. This is true for both fetching and processing. For example, the user creates three requests for the same URL, two of the requests want the image to be resized to the same target size while the other one wants the original image.DFImageManagerwill fetch the original image once, then it will resize it once.DFImageManagerprovides a fine grained control over which requests should be considered equivalent (both in terms of fetching and processing).
  • High quality source code base that successfully manages complexity and follows best design principles and patterns, including dependency injection that is used throughout.
DFImageRequestID *requestID = [[DFImageManager sharedManager] requestImageForResource:[NSURL URLWithString:@"http://..."] completion:^(UIImage *image, NSDictionary *info) {    // Use decompressed image and inspect info  }];    [requestID cancel]; // requestID can be used to cancel the request

项目主页:http://www.open-open.com/lib/view/home/1425129199077