ios8 - Unable to see UIImage once stored and sent to Server form CoreData? -


the first part of code camera button pressed not before checking if textfield has been filled, checks camera type. normal here me thinks.once picture has been taken resize image of smaller size convert nsstring nsstring data stored in coredata , sent off server shown on screen.

//this camera press button

-(ibaction)takepicture:(uibutton*)sender{

        if (printedname.text.length ==0){  uialertview*alert=[[uialertview alloc]initwithtitle: @"please enter name"message:@""delegate:self cancelbuttontitle:@"dismiss"otherbuttontitles:nil];[alertshow];return; 

}

uiimagepickercontroller *picturetaker = [[uiimagepickercontroller alloc] init];  picturetaker.delegate = self;      if ([uiimagepickercontroller issourcetypeavailable:      uiimagepickercontrollersourcetypecamera]) {      picturetaker.sourcetype = uiimagepickercontrollersourcetypecamera; } else if([uiimagepickercontroller issourcetypeavailable:          uiimagepickercontrollersourcetypesavedphotosalbum]){          picturetaker.sourcetype  = uiimagepickercontrollersourcetypesavedphotosalbum; } [self presentviewcontroller:picturetaker animated:yes completion:nil];} 

-(void)imagepickercontroller:(uiimagepickercontroller *)picturetaker didfinishpickingmediawithinfo:(nsdictionary *)info {

nslog(@"%@", info); nsstring * mediatype = [info objectforkey:uiimagepickercontrollermediatype]; if([mediatype isequal:(__bridge nsstring *)kuttypeimage]){      [picturetaker dismissviewcontrolleranimated:yes completion:nil];      base64image = [info objectforkey:uiimagepickercontrollereditedimage];      base64image = [info objectforkey:uiimagepickercontrolleroriginalimage];      // resize image     cgsize newsize = cgsizemake(100.0f,60.0f);     uigraphicsbeginimagecontext(newsize);     [base64image drawinrect:cgrectmake(0,0,newsize.width,newsize.height)];     base64image = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();      nsdata *data = uiimagejpegrepresentation(base64image, 1.0);     base64string = [data base64encodedstringwithoptions:nsdatabase64encodingendlinewithlinefeed];     //base64string = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding];      nslog(@" image (%@), width: %.0f, height: %.0f, scale: %0.2f, string len %lu",base64image,base64image.size.width,           base64image.size.height, base64image.scale, (unsigned long)base64string.length); }uiimagewritetosavedphotosalbum(base64image, self, null , null);} 

it seem send ok save kind of get's lost half way through, can iv been >trying sort out days now, iv included below console output see >aswell, can help.

uiimagepickercontrollermediatype = "public.image"; uiimagepickercontrolleroriginalimage = "<uiimage: 0x17056260> size {2448, 3264} orientation 3 scale 1.000000"; 

} printing description of data: 2014-11-27 16:58:36.360 mobile[537:64747] image ( size {100, 60} orientation 0 scale 1.000000), width: 100, height: 60, scale: 1.00, string len 0

i managed fix problem code below:

if (self.base64image!= nil){      nsstring *strimagedata = [self.base64image stringbyreplacingoccurrencesofstring:@"+" withstring:@"%2b"];      nsstring *param =[nsstring stringwithformat:@"photo=%@", strimagedata];      [values addobject:param]; } 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -