iphone图像细节(从照片库中选择)

时间:2012-02-15 10:08:25

标签: iphone ios image path uiimagepickercontroller

我想获取我从iphone库中选择的所有图像细节 喜欢

  1. 图片名称

  2. 图片路径

  3. 图片类型

  4. 图片尺寸

  5. 图片ID

  6. 我选择了像

    这样的图像
       picker1 = [[UIImagePickerController alloc]init];
        picker1.delegate = self;
        picker1.allowsEditing= YES;
        //picker1.showsCameraControls = YES;
        picker1.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        [self presentModalViewController:picker1 animated:YES];
        [picker1 release];
    

    然后选择图像

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;
    {
        isImage = TRUE;
    
        image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
        sendimageview.image=image;
        appDelegate.mediabuttonpress=TRUE;
    }
    

    并且对于路径我尝试了这个但没有得到正确的路径

     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *strPath= [paths objectAtIndex:0];
     strPath = [strPath stringByAppendingPathComponent:imageName];
     NSLog(@"*******Path %@",strPath); 
    

    需要帮助......

    回复

    谢谢..

3 个答案:

答案 0 :(得分:0)

我认为你必须使用ALAsset类,因为我不确定,UIImage提供你需要的所有信息(尤其是GPS信息)。

答案 1 :(得分:0)

您无法从图书馆获取图像的“真实”路径,即使您可以获取它也无法访问。

答案 2 :(得分:0)

试试这个

   - (void)imagePickerController:(UIImagePickerController *)picker 
didFinishPickingMediaWithInfo:(NSDictionary *)info {
    NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];

  ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

  [library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
   ALAssetRepresentation *representation = [asset defaultRepresentation];
   metadataDict = [[representation metadata] retain]; 
   NSLog(@"%@",metadataDict);


  } failureBlock:^(NSError *error) {
   NSLog(@"%@",[error description]);
  }];
[library release];
}

您还必须使用__block标识符声明它。

       __block NSDictionary *metaDataDict;