Giter VIP home page Giter VIP logo

lkimagekit's Introduction

LKImageKit

简介

LKImageKit是一个高性能的图片框架,包括了图片控件,图片下载、内存缓存、磁盘缓存、图片解码、图片处理等一系列能力。合理的架构和线程模型,并特别针对不同场景进行优化,能充分发挥硬件的性能。

同时,该框架具有高度的扩展性。在此框架下,开发者可以自定义图片框架中的任何一个部分,比如:自定义图片显示逻辑、自定义缓存、自定义下载组件、自定义解码器、自定义图片处理算法等等。

introduction

LKImageKit is a high-performance image framework, including a series of capabilities such as image views, image downloader, memory caches, disk caches, image decoders, image processors. Reasonable architecture and threading model, and especially for different scenarios to optimize, give full play to the hardware performance

The framework has a high degree of scalability. In this framework, developers can customize any part of the picture frame, such as: custom picture display logic, custom cache, custom downloader, custom decoders, Custom image processing algorithms and more.

Video

github:https://github.com/kelingjie1/MyResources/blob/master/FastImageLoad.MOV

youtube:https://youtu.be/xz503GV5PpE

主要特性:

  • 支持取消

  • 支持请求合并

  • 支持渐进式加载

  • 支持优先级

  • 支持先加载小图再加载大图

  • 支持预加载、预解码

  • 线程安全

  • 调度、解码、加载、处理使用独立线程、且有并发控制

  • 高度模块化,可由开发者自定义各部分模块

Main features:

  • Support canceled

  • Support for the request of the merger

  • Support for progressive loading

  • Support priority

  • Support the first load the thumbnail and then load the big picture

  • Support for preloading, pre-decoding

  • Thread safety

  • Scheduling, decoding, loading, dealing with the use of independent threads, and concurrency control

  • A high degree of modularity, developers can customize each part of the module

模块:

加载模块

  • 网络文件加载(带文件缓存)

  • 本地文件加载

  • 相册加载

  • Bundle加载

解码模块

  • ImageIO

系统内置解码模块,支持PNG、JPG、GIF,支持渐进式解码

缓存模块

  • LRU、FIFO双队列缓存

  • MapTable自动缓存

Module:

Loader:

  • Network file loading (with file cache)

  • Local file loading

  • Album file loading

  • Bundle file loading

Decoder:

  • ImageIO

System built-in decoding module, support for PNG, JPG, GIF, support for progressive decoding

Cache:

  • LRU, FIFO dual queue cache

  • MapTable automatically cache

lkimagekit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lkimagekit's Issues

Remove MOV video file form project

It's waste of network traffic. Can post to video platform and add link to it.

Also remove from history.

Everytime when integrate it, need to waste 25mb.

缺少一份文档

没有文档,单纯看代码,走断点有点吃不消,不能完全看懂这份代码。

progress图片加载会出现线程锁和内存泄漏

工具:XCode 9.0 模拟器:iOS11.0 iPhone 8 plus

步骤:
1.打开Demo,点击清理缓存
2.进入自定义属性页面,打开Progresive开关,点击大图 big.jpg
结果:大部分情况会出现crash的情况

问题推测:多线程导致的问题

初步分析:

  1. LKImageRequest对象isDecodingprogress属性存在data race现象
    2.LKImageSystemDecoder对象中对图片数据渐进式解码成CGImageRef的过程会出现BAD_ACCESS

    问题行代码:
    else if (count == 1){
    CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, option);

pod 安装后运行报错

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"operator delete(void*)", referenced from:
-[LKImageMemoryCache clear] in libLKImageKit.a(LKImageMemoryCache.o)
-[LKImageMemoryCache deleteCache:] in libLKImageKit.a(LKImageMemoryCache.o)
std::__1::list<ImageNode*, std::__1::allocator<ImageNode*> >::erase(std::__1::__list_const_iterator<ImageNode*, void*>) in libLKImageKit.a(LKImageMemoryCache.o)
-[LKImageMemoryCache clearLastOneInLRU] in libLKImageKit.a(LKImageMemoryCache.o)
std::__1::list<ImageNode*, std::__1::allocator<ImageNode*> >::pop_front() in libLKImageKit.a(LKImageMemoryCache.o)
-[LKImageMemoryCache clearLastOneInFIFO] in libLKImageKit.a(LKImageMemoryCache.o)
-[LKImageMemoryCache cacheImage:URL:] in libLKImageKit.a(LKImageMemoryCache.o)
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

有参数的URL请求失效问题

LKImage 5.3.1

LKImageNetworkFileLoaderTask

  • (void)dataWithRequest:(LKImageRequest *)request callback:(LKImageDataCallback)callback

URL = [URL stringByAppendingString:@"?tp=sharp"];

这里有对URL进行拼接 会导致如果该图片的URL本身就是带参数的 拼接后就出错了

比如:
http://qn-hunter-photo.fishtrip.cn/o_1bfu583ba1qg51ev61cdi1imvilg0.png-medium2?e=1525848700&token=nMq5NmyPkrs9m3DNnIQwz9UYNL7RZjfFiTpCZ851:Rjz0f5vTfU27edqjnPYj7ByJ15U=

拼上之后变成:
http://qn-hunter-photo.fishtrip.cn/o_1bfu583ba1qg51ev61cdi1imvilg0.png-medium2?e=1525848700&token=nMq5NmyPkrs9m3DNnIQwz9UYNL7RZjfFiTpCZ851:Rjz0f5vTfU27edqjnPYj7ByJ15U=?tp=sharp

看是否能改成这样:
if ([URL rangeOfString:@"?"].location == NSNotFound) {
URL = [URL stringByAppendingString:@"?tp=sharp"];
} else {
URL = [URL stringByAppendingString:@"&tp=sharp"];
}
或者不要这一行代码 单独出个插件处理tp=sharp

decoding and caching should happen at image creation time?

首先致敬诸位大神的开源精神
LKImageSystemDecoder里有些疑惑之处,还请指教:
CFDictionarySetValue(option, kCGImageSourceShouldCacheImmediately, kCFBooleanFalse);
kCGImageSourceShouldCacheImmediately 看了下默认即为false,而且不少优化的教程都表示先decode and caching 会减轻图片实际用于显示时cpu的解码压力。
不知此处有何其它考虑?

- [LKImageLocalFileLoader dataWithRequest:callback:] fileURL 生成应该使用 - [NSURL fileURLWithPath:] 而不是 - [NSURL URLWithString:],如果 request.URL 中可能包含 fileURL:// 前缀,则此处存在歧义,是否应该替换其他属性或者进行重命名?

  • (void)dataWithRequest:(LKImageRequest *)request callback:(LKImageDataCallback)callback
    {
    if (![request isKindOfClass:[LKImageURLRequest class]])
    {
    NSError *error = [LKImageError errorWithCode:LKImageErrorCodeInvalidLoader];
    callback(request, nil, 0, error);
    return;
    }
    NSString *URL = ((LKImageURLRequest *) request).URL;
    NSURL *fileURL = [NSURL URLWithString:URL];
    NSData *data = [NSData dataWithContentsOfURL:fileURL];
    if (data)
    {
    callback(request, data, 1, nil);
    }
    else
    {
    NSError *error = [LKImageError errorWithCode:LKImageErrorCodeFileNotFound];
    callback(request, nil, 0, error);
    }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.