Objective c download pictures from remote URL
-(UIImage *) Getimagefromurl: (NSString *) theURL {
uiimage = NULL;
NSString *imagefilename = [bt_strings getfilenamefromurl:theurl];
NSData *imagedata = [[NSData alloc] Initwithcontentsofurl:[nsurl Urlwithstring:theurl]];
Theimage = [[UIImage alloc] initwithdata:imagedata];
[Bt_filemanager saveimagetofile:theimage filename:imagefilename];
return theimage;
}
Objective C Gets the picture from the remote address and modifies the size
nsstring* ImageURL = [NSString stringWithFormat: @ "http://theimageurl.com/?id=%@", [[Resultsentries objectAtIndex:0] Objectforkey: @ "Image_large"]];
nsdata* ImageData = [[NSData alloc]initwithcontentsofurl:[nsurl Urlwithstring:imageurl]];
uiimage* image = [[UIImage alloc] initwithdata:imagedata];
Resize Image
Cgsize newsize = cgsizemake (+);
Uigraphicsbeginimagecontext (newsize);/A cgsize that has the size for you want
[image Drawinrect:cgrectmake (0,0,newsiz E.width,newsize.height)];
Image is the original uiimage
uiimage* newimage = Uigraphicsgetimagefromcurrentimagecontext ();
Uigraphicsendimagecontext ();
ImageHeight = image.size.height;
[Imagemain Setimage:newimage];
[ImageData release];
[Image release];
The above mentioned is the entire content of this article, I hope you can enjoy.