-(void) Imagepickercontroller: (uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: ( nsdictionary<nsstring *,ID> *) info{
//1. Get a photo of the currently selected album
UIImage * image = [info objectforkey:uiimagepickercontrolleroriginalimage];
//1.1 Create a ImageView property, display the picture, Change the ImageView (Mode) to (Aspect Fit)
self. Userimage. Image = image;
//2. get the picture name
Note : To use the following actions , you need to introduce the following content
#import <AssetsLibrary/ALAsset.h>
#import <AssetsLibrary/ALAssetsLibrary.h>
#import <AssetsLibrary/ALAssetsGroup.h>
#import <AssetsLibrary/ALAssetRepresentation.h></span>
nsurl *imageurl = [info valueforkey:uiimagepickercontrollerreferenceurl];
alassetslibraryassetforurlresultblock resultblock = ^ (alasset *myasset)
{
alassetrepresentation *representation = [Myasset defaultrepresentation];
nsstring *filename = [representation fileName];
self. Imgname = fileName;
sxlog(@ "FileName:%@",self. ) Imgname);
//2.1 Change your avatar
[self img_reqest: Image imgname: fileName];
};
2.2
alassetslibrary* assetslibrary = [[alassetslibrary alloc] init];
[Assetslibrary assetforurl: ImageURL resultblock: Resultblock failureblock:nil];
[self dismissviewcontrolleranimated:YES completion:nil];
}
-(void) Img_reqest: (UIImage *) image imgname: (nsstring *) imgname {
//2.1.1 UIImage picture turns into Base64 string:
nsdata *data = uiimagejpegrepresentation(image, 1.0f);
nsstring *encodedimagestr = [Data base64encodedstringwithoptions: Nsdatabase64encoding64characterlinelength];
2.3 Initiating a request
}
IOS images turn into base64 encoding
Http://www.cnblogs.com/ZGSmile/articles/5587226.html
Get the name information of the system album picture obtained through Uiimagepackercontroller and save the System album to the Local
Http://www.myexception.cn/operating-system/1833349.html
iOS Uploading Pictures base64 demo