-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
fix issues: SDWebImageDecodeFirstFrameOnly flag is ignored when image loaded from cache #2725
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2725 +/- ##
==========================================
- Coverage 83.94% 83.75% -0.19%
==========================================
Files 56 56
Lines 6221 6225 +4
==========================================
- Hits 5222 5214 -8
- Misses 999 1011 +12
Continue to review full report at Codecov.
|
The issue I undertood. But the PR seems need some polishing. For So, the fix it not hard. And there are no need to create that category method. (I think this will misleading some user). if ((options & SDImageCacheDecodeFirstFrameOnly) && image.sd_isAnimated) {
#if SD_UIKIT || SD_WATCH
image = image.images.firstObject;
#else
image = [NSImage initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
#endif
} |
Actually, this is a interesting problem. Assume the case: // ListView.m
SDAnimatedImageView *listImageView = [SDAnimatedImageView new];
// List page, load a GIF and play animation
[listImageView sd_setImageWithURL:gifURL];
// Now, the `SDAnimatedImage` for gifURL is cached in memory
// DetailView.m
SDAnimatedImageView *detailImageView = [SDAnimatedImageView new];
[detailImageView sd_setImageWithURL:gifURL options:SDWebImageDecodeFirstFrameOnly]; // Same GIF URL, but this time I specify first frame only
// Should hit the memory cache, so now comes the problem Should we still populate the original Or need we just create a empty first frame image for this ? |
Maybe we should also fix the same issue for SDWebImageYYPlugin 😅 |
@cntrump Hi. Any update ? This fix should be picked in v5.0.3 release. If you have time, please check the review status for better fix. |
… loaded from cache.
LGTM. It's better to provide a test case for this. If you have time, you can add one, or I can do this for you. |
emmm... I don't know how to do this, so would you mind helping me add one ? |
… loaded from cache.
New Pull Request Checklist
I have read and understood the CONTRIBUTING guide
I have read the Documentation
I have searched for a similar pull request in the project and found none
I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
I have added the required tests to prove the fix/feature I am adding
I have updated the documentation (if necessary)
I have run the tests and they pass
I have run the lint and it passes (
pod lib lint
)This merge request fixes / refers to the following issues: ...
Pull Request Description
first time, load from internet, it is a thumbnail imageview.
second time, load the same image from loader, it is a detail imageview.
and when thumbnail imageview load the image using
SDWebImageDecodeFirstFrameOnly
on next time, SDWebImage will give it an animated image, it should be a static image.