GithubHelp home page GithubHelp logo

olimageview's People

Contributors

dtorres avatar ejensen avatar karpelcevs avatar nickoneill avatar njuxjy avatar philippb avatar shingofukuyama avatar

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

olimageview's Issues

Cache imageNamed

The current implementation of UIImage caches the instances created by this method. And GIFs are really expensive to create.
So, why not?

Please bump tiny to 1.5.1 and push new pod

Been seeing this warning for several months now
OLImageView/OLImage.m:306:26: warning: unused function 'OLCreateDecodedCGImageFromCGImage' [-Wunused-function]

I don't see the method in OLImage.m anymore so I can only assume it's been fixed. Can we get a new version of the pod to reflect this change? Thanks.

Load each frame in separate threads

Right now, all the frames are obtained asynchronously in one thread, thus making the load of each frame synchronous.

The idea is to load each frame on a different thread and become truly asynchronous.

I haven't developed anything yet, It would be nice to read some opinions about it.
Or maybe leave as it is.

Ops! I got o roadblock when I try to mix the olimageview.layer with a video

The requirement is to mix a gif with a video,it need to compose the composited video frames with the Core Animation layer. but when i use it in swift, the OLImageView.layer just display the first frame of the gif then stop,But when i use it with objc ,it works very well. The objc code probably like this:

- (AVVideoCompositionCoreAnimationTool *)generateGifAnimationTool:(NSString *)gifPath{
    CALayer *parentLayer = [CALayer layer];
    CALayer *videoLayer = [CALayer layer];
    parentLayer.frame = CGRectMake(0, 0, 720, 720);
    videoLayer.frame = CGRectMake(0, 0, 720, 720);
    [parentLayer addSublayer:videoLayer];
    [parentLayer addSublayer:[self genrateGifLayer:gifPath]];
    return [AVVideoCompositionCoreAnimationTool
            videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:videoLayer inLayer:parentLayer];
}
- (CALayer *)genrateGifLayer:(NSString *)gifPath{
    OLImageView *oliimage = [OLImageView new];
    NSData *GIFDATA = [NSData dataWithContentsOfFile:gifPath];
    oliimage.image = [OLImage imageWithData:GIFDATA];
    CGFloat width = oliimage.image.size.width;
    CGFloat height = oliimage.image.size.height;
    CALayer *overlayLayer1 = oliimage.layer;
    overlayLayer1.frame = CGRectMake(0, 0, width, height);
    [overlayLayer1 setDuration:4.0];
    [overlayLayer1 setBeginTime:0.0];
    return overlayLayer1;
}

Is there anything wrong with it? tks!

kCGImagePropertyGIFLoopCount

So, if we strive for the perfect animated GIF implementation - this should also evaluate kCGImagePropertyGIFLoopCount :)

HowTochangeDifferentGif

I have a imageView is playing a.gif ,when it end I want to play b.gif ,but it isnot working ,how can I do ?

When working with AFNetworking, there will be a retain cycle.

[self setResponseOLImage:[OLImage imageWithData:self.responseData];

This line in AFImageRequestOperation+OLImage makes AFImageRequestOperation obj strong references OLImage obj, and because in UIImageView+AFNetworking, there's such code:

self.af_imageRequestOperation = requestOperation;

which will cause your OLImage obj strong references AFImageRequestOperation obj, thus retain cycle occurs.

Is OLImage released?

I use OLImage in the viewB's drawRect method. I use a normal ViewA to push ViewB, and pop ViewB repeatedly. After about 20 times, my app crashed after received several memory warnings.
I use instrument to monitor the memory usage, and you can see the result below.
image

My code to load gif is like:

@property (weak, nonatomic) IBOutlet OLImageView *gifImageView;


        if (!self.gifImageView.image) {
            self.gifImageView.image = [OLImage imageNamed:@"好.gif"];
            [self.gifImageView setUserInteractionEnabled:YES];
            [self.gifImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]];
        }

I'm use ARC, I think the gif data should be released by iOS when ViewB popped. Or at least when my app received memory warnings.
Am I doing something wrong?

AFNetworking + OLImage combo

In the categories folder, there exists an AFImageRequestOperation+OLImage category.

I think it's a great idea, and has the potential to add a lot of value to this library.

However, I am not sure how to implement this, as it seems unclear due to the lack of documentation.

Can better instructions on the use of AFImageRequestOperation+OLImage be added to the Readme documentation.

Thank you.

Large Gifs and iOS crashing

I'm downloading sometimes large GIF files (800px images) with some complicated animations (i.e. large amounts of data) and they often times crash the app and cause the to crawl. Is there any way to improve that?

Possibly a memory leak

Ran a static analyzer in last version of xcode and got this. Just wanted to be sure you know/aware of this

image
image

Include improved AFNetworking category on the CocoaPod

The CocoaPod for OLImageView is pinned to the tag 1.1.0.

The AFNetwork category back in the 1.1.0 days was generated a linker warning that was since fixed.

Could we make a release so that pod users stop getting that warning? Could even just be a 1.1.1 that would be a branch off 1.1.0 just with the category fix cherry picked.

Thanks :)

Does Not Build For iPhone 5S

line 39: FLT_EPSILON

//it says use of undeclared "FLT_EPSILON" variable

Is this because the iPhone 5S has a 64 bit processor?

Do you know a solution to this?

Release 1.2.1

Please release this one w/ FLT_EPSILON, since our CI breaks too often :)

[OLImageSourceArray _objectAtIndex:] CGImageSourceCreateImageAtIndex crash randomly

I can't reproduce this crash. FYI, I'm using release version 1.5.

SIGTRAP
0
0 CoreFoundation 0x00000001824b1cec _forwarding
1 CoreFoundation 0x00000001823b6c1c CF_forwarding_prep_0 + 80
2 CoreFoundation 0x000000018238d378 CFRelease + 516
3 CoreFoundation 0x00000001823ad218 CFArraySetValueAtIndex + 480
4 ImageIO 0x0000000183666c44 makeImagePlus
5 ImageIO 0x0000000183666248 CGImageSourceCreateImageAtIndex + 176
6 WeiboFun 0x0000000100282328 -OLImageSourceArray _objectAtIndex:
7 WeiboFun 0x00000001002821c8 -OLImageSourceArray objectAtIndex:
8 WeiboFun 0x0000000100205948 -OLImageView displayLayer:
9 QuartzCore 0x00000001865caf74 CA::Layer::display()
10 QuartzCore 0x00000001865ac75c CA::Layer::display_if_needed(CA::Transaction
)
11 QuartzCore 0x00000001865ac414 CA::Layer::layout_and_display_if_needed(CA::Transaction
)
12 QuartzCore 0x00000001865abc08 CA::Context::commit_transaction(CA::Transaction*)
13 QuartzCore 0x00000001865ab98c CA::Transaction::commit()
14 QuartzCore 0x00000001866011d8 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
15 IOKit 0x00000001835f98d0 IODispatchCalloutFromCFMessage + 376
16 CoreFoundation 0x0000000182450ce0 ___CFMachPortPerform
17 CoreFoundation 0x00000001824658fc _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
18 CoreFoundation 0x000000018246585c ___CFRunLoopDoSource1
19 CoreFoundation 0x00000001824637dc ___CFRunLoopRun
20 CoreFoundation 0x00000001823911f4 CFRunLoopRunSpecific + 392
21 GraphicsServices 0x000000018b51f5a4 GSEventRunModal + 164
22 UIKit 0x0000000186cc2784 UIApplicationMain + 1484
23 WeiboFun 0x00000001000b0144 main (main.m:14)
24 libdyld.dylib 0x0000000193262a08 _start

uitableview

Hi, can you suggest a method to use this awesome image in a uitableview ?

Thanks

GIFs freeze while scrolling

When using this library, which is very useful, I have found one problem.

The GIFs freeze while I scroll through a page.

How do I stop them from freezing while scrolling?

Thanks.

Infinite recursion in initWithData

If OLImage initWithData is used with data that doesn't contain an animated gif, it starts an infinite recursion loop.

This issue was introduced in commit 9dfe840, and is caused by UIImage calling [self initWithData:data] within its initWithData:scale: method when the scale is 1.

infinite_recursion

A bug after dealloc OLImageView and solution

  • (void)displayLayer:(CALayer *)layer
    {
    if (!self.animatedImage || [self.animatedImage.images count] == 0) {
    return;
    }
    layer.contents = (__bridge id)([ [self.animatedImage.images objectAtIndex:self.currentFrameIndex] CGImage]);
    }

when image in self.animatedImage still a NSNull object, cause crash! May change to :

  • (void)displayLayer:(CALayer *)layer
    {
    if (!self.animatedImage || [self.animatedImage.images count] == 0) {
    return;
    }
    id image = [self.animatedImage.images objectAtIndex:self.currentFrameIndex];
    if ([image isKindOfClass:[UIImage class]]) {
    layer.contents = (__bridge id)([image CGImage]);
    }
    }

OLImage + OLImageView dealloc isn't called

I haven't looked into the reason yet but dealloc isn't called in either of these classes. There's some quirk where something is holding a retain somewhere because my (fairly large) gifs are building up in memory.

Memory issues with caching frames

Uncompressed GIF frames are very, very large. Even when only caching 10 at a time, memory usage can spike 50-100 MB when just one or two GIFs are playing. This kind of memory pressure is just untenable for our app (and most). Is there a reason caching is even needed?

We're using a fork that completely removes caching, simply delivering CGImage frames directly to the layer, releasing immediately after. This approach lowers memory requirements to a single frame, and improves performance dramatically. In the demo app, memory use is cut in half.

I'd be happy to submit a PR to address this if you're open to such a major change? It would also provide a chance to simplify things and clean up some of the internals.

Image rendered too large

With contentMode UIViewContentModeCenter…

Aimv = [[OLImageView alloc] initWithImage:[OLImage imageNamed:@"google-io.gif"]];
Aimv.contentMode = UIViewContentModeCenter;

…the image is rendered much larger than if using a UIImageView.

It seems that the scale of the image is not being accounted for. Any idea how I can work around this?

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.