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

<Error>: ImageIO: JPEG Corrupt JPEG data: premature end of data segment #4

Closed
nullproduction opened this issue Mar 8, 2014 · 6 comments
Labels

Comments

@nullproduction
Copy link
Contributor

Hi. Thank you for the lib.
I get error for image : http://www.radio-t.com/images/cover.jpg

<Error>: ImageIO: JPEG Corrupt JPEG data: premature end of data segment

My device - IOS 7.0.4 / iphone 4s

Screenshot with bug: https://www.dropbox.com/s/x4x7ljz7ef7pyg5/2014-03-08%2012.51.13.png

@nullproduction
Copy link
Contributor Author

The simulator does not have this problem

@hpique
Copy link
Member

hpique commented Mar 8, 2014

Thanks for reporting this. I'll give it a look shortly.
On Mar 8, 2014 10:13 AM, "nullproduction" notifications@github.com wrote:

The simulator does not have this problem

Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-37093168
.

@hpique
Copy link
Member

hpique commented Mar 8, 2014

I have an inkling of what might be going on. Can you reproduce this problem consistently?

@nullproduction
Copy link
Contributor Author

I did something like this:

- (void)viewDidLoad
{
    [super viewDidLoad];

    HNKCacheFormat *format = [[HNKCacheFormat alloc] initWithName:@"thumbnail"];
    format.compressionQuality = 1;
    format.allowUpscaling = YES;
    format.diskCapacity = 50 * 1024 * 1024;
    format.preloadPolicy = HNKPreloadPolicyLastSession;
    format.scaleMode = HNKScaleModeAspectFill;
    [[HNKCache sharedCache] registerFormat:format];

    UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 60, 60)];
    [self.view addSubview:img];
    [img hnk_setImageFromURL:[NSURL URLWithString:@"http://www.radio-t.com/images/cover.jpg"]];
}

But now I was not able to repeat the problem, although it has been repeated several times in a row

@hpique hpique closed this as completed in 9cd50de Mar 8, 2014
@hpique hpique added the bug label Mar 8, 2014
@hpique
Copy link
Member

hpique commented Mar 8, 2014

I wasn't properly handling the case where a remote image was partially downloaded.

Now the UIImageView category ignores partial data. I also added a failureBlock to handle network errors such as this.

I'd appreciate if you'd let me know if everything works as expected with the latest changes.

@nullproduction
Copy link
Contributor Author

thank you :)

bambuh pushed a commit to Swivl/Haneke that referenced this issue Jun 16, 2020
 - [SI-1051] Disc cache with empty key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants