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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -