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

Failure loading Giphy animted webp via url in PINAnimatedImageView #504

Closed
chadpod opened this issue Jun 5, 2019 · 1 comment · Fixed by #507
Closed

Failure loading Giphy animted webp via url in PINAnimatedImageView #504

chadpod opened this issue Jun 5, 2019 · 1 comment · Fixed by #507

Comments

@chadpod
Copy link

chadpod commented Jun 5, 2019

I'm trying to load an animated webp from Giphy into a PINAnimatedImageView. It would download fine, but then fail to decode the image. I found myself having to add the following PIN_WEBP bit to PINAlternateRepresentationProvider:

@implementation PINAlternateRepresentationProvider

- (id)alternateRepresentationWithData:(NSData *)data options:(PINRemoteImageManagerDownloadOptions)options
{
    if ([data pin_isAnimatedGIF]) {
        return [[PINCachedAnimatedImage alloc] initWithAnimatedImageData:data];
    }
#if PIN_WEBP
    if ([data pin_isAnimatedWebP]) {
        return [[PINCachedAnimatedImage alloc] initWithAnimatedImageData:data];
    }
#endif
    return nil;
}

@end

to get it working. Can you point me in the right direction as to what I might be doing wrong or is this above change needed?

Here is how I am fetching the image:

        [self.imageView pin_setImageFromURL:url completion:^(PINRemoteImageManagerResult * _Nonnull result) {
            [self.imageView pin_updateUIWithRemoteImageManagerResult:result];
            [self.activityView stopAnimating];
        }];

Here is one of the animated webp urls:

https://media1.giphy.com/media/26gsxJfJgIyYXNoD6/100.webp
@chadpod chadpod changed the title Failure loading animted webp in PINAnimatedImageView Failure loading Giphy animted webp via url in PINAnimatedImageView Jun 5, 2019
@garrettmoon
Copy link
Collaborator

Eeep, this is definitely a bug! I have a fix as part of another WebP bug in a branch I'm discussing with Google. I'm guessing I'll put up a PR soon, in the meantime here's the branch: https://github.com/pinterest/PINRemoteImage/tree/fixWebPAnimationBlending

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

Successfully merging a pull request may close this issue.

2 participants