objective c - How to pick the Path Asset in a existing image with ALAssetsLibrary? -
i have code write / create new image in ios photo library:
alassetslibrary *library = [[alassetslibrary alloc] init]; // request save image camera roll [library writeimagetosavedphotosalbum:[imagem cgimage] orientation:(alassetorientation)[imagem imageorientation] completionblock:^(nsurl *asseturl, nserror *error){ //code here... }
the code this, stamped in code writeimagetosavedphotosalbum, in time don`t need create new image in library, need path of image exist in library, in case image inside variable 'imagem'.
what code change writeimagetosavedphotosalbum path of image?
[edit]
i image inside variable imagem
in format:
-(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info{ uiimage *imagem = [info objectforkey:uiimagepickercontrolleroriginalimage]; [imagepicker dismissviewcontrolleranimated:yes completion:nil]; }
you have:
-(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info{ uiimage *imagem = [info objectforkey: uiimagepickercontrolleroriginalimage]; }
but don't need image; need path. be:
-(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info{ nsurl *imageurl = [info objectforkey: uiimagepickercontrollerreferenceurl]; }
now have url , can store it; can retrieve actual image later if need it.
to asset url image, see answer here: https://stackoverflow.com/a/22968941/341994
Comments
Post a Comment