1
    UIImage *image                = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:_actualImageURL.absoluteString];
    if(!image) {
        image = [UIImage imageNamed:@"placeholderImage"];
        [self makeImageAvailableAtURL:_actualImageURL];
    }

    self.messageImage.image       = [image isImageGif] ? image.images.lastObject : image;

We are loading image from server. If it is some gif image, we get image with .images ( i got no another way how to understand is it gif or not).

- (BOOL)isImageGif {
    return self.images;
}

But if we store gif image with

 [[SDImageCache sharedImageCache] storeImage:image forKey:wImageURL.absoluteString];

,it lose .images .

Any idea how handle this?

Zaporozhchenko Oleksandr
  • 4,660
  • 3
  • 26
  • 48
  • http://stackoverflow.com/questions/4147311/finding-image-type-from-nsdata-or-uiimage Please check this link – Muhammad Zohaib Ehsan Nov 24 '15 at 11:27
  • Well, i checked it. U want me store NSData instead UIImage or so? Understanding where gif or not, i already have ( but dirty). – Zaporozhchenko Oleksandr Nov 24 '15 at 11:59
  • NSData *imageData = UIImagePNGRepresentation(myImage.image); you have to convert it to nsdata . P.S You can also create nsdat from a file provide it a url. https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/#//apple_ref/occ/clm/NSData/data – Muhammad Zohaib Ehsan Nov 24 '15 at 12:05
  • Okay, lets create NSData from image. It will save gif? It will convert to png/jpeg obliviously. And anyway need cache NSData somehow. – Zaporozhchenko Oleksandr Nov 24 '15 at 13:50
  • Yes you are right . If you directly query on NSData from provide by the web service it will be good. I guess you have to save nsdata and when you required the image convert it to image. – Muhammad Zohaib Ehsan Nov 24 '15 at 14:46

1 Answers1

0

Well, solution is using:

[[SDImageCache sharedImageCache] storeImage:image recalculateFromImage:NO imageData:data forKey:key toDisk:YES];

instead just:

 [[SDImageCache sharedImageCache] storeImage:image forKey:key];

I have found it there: https://github.com/rs/SDWebImage/issues/916

Zaporozhchenko Oleksandr
  • 4,660
  • 3
  • 26
  • 48