how to get the path of the image which is in iphone gallery

前端 未结 2 1244
谎友^
谎友^ 2021-02-10 23:42

i need to upload a image from iphone gallery ,but i am not getting the path of the picked image (using image picker)

in the image picke

2条回答
  •  滥情空心
    2021-02-11 00:21

    Convert your image in NSData and then Upload this NSData.

    Your image in NSData

    NSData *dataImage = UIImageJPEGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"],1);
    

    Or you can convert yourImage in NSData using

    NSData *dataImage = UIImagePNGRepresentation(yourImageView.image);
    

    For more read NSData Class Reference

提交回复
热议问题