Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I check if downloaded image is corrupt or not before saving?

can I check if downloaded image is corrupt or not before saving it into my document directory? if yes then please tell me how? thank you

like image 673
rptwsthi Avatar asked Feb 02 '26 21:02

rptwsthi


1 Answers

UIImage *im = [[UIImage alloc] initWithData:YourNSData];
UIImageView *imview;

// test to see if the image was successfully created
if (im){
   imview = [[UIImageView alloc] initWithImage:im];
}

Hope this helps

like image 151
Stefan Ticu Avatar answered Feb 05 '26 14:02

Stefan Ticu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!