ios - Why reducing an image size will rotate the image? -
i not sure if doing wrong in reducing image size or happening saving in cloud.
i take image camera or camera roll , save parse cloud. when retrieve image , display it, rotated 90 degree left.
i checked image on cloud , saving rotated. when take picture camera , before reducing size show on uiimageview
, not rotated.
here code:
nsdata *imagedata = uiimagepngrepresentation(userimage.image); if (imagedata.length > 10485760) { uiimage *compressedpngimage = [uiimage imagewithdata:imagedata]; nslog(@"image on sized"); uigraphicsbeginimagecontext(cgsizemake(480,320)); //cgcontextref context = uigraphicsgetcurrentcontext(); [compressedpngimage drawinrect: cgrectmake(0, 0, 480, 320)]; uiimage *smallimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); imagedata = uiimagepngrepresentation(smallimage); pffile *file = [pffile filewithname:@"pic.png" data:imagedata]; pfquery *query = [pfuser query]; [query getobjectinbackgroundwithid:[[pfuser currentuser] objectid] block:^(pfobject *user, nserror *error) { user[@"image"] = file; [user saveinbackground]; }]; saveimagebtn.hidden = true; }
Comments
Post a Comment